remove file extension google app engine
Asked Answered
U

2

2

I uploaded my client's webpage using google app engine and it is working fine. It is a very simple webpage with 12 static files (.html all of them)

I have to remove the file, but I don't know if this can be done modifying the app.yaml or the main.py

For example: I have www.example.com/page.html, I want www.example.com/page

Unlicensed answered 26/11, 2013 at 3:0 Comment(2)
what file do you need to remove? One of that 12 static files? If so, just delete the file and upload the application again.Spongioblast
Thanks musketyr, I edited the question, what i want to remove is the .html form the url. For example: i have www.example.com/page.html i want www.example.com/pageUnlicensed
S
5

You can try this on your app.yaml assuming all your html files are in static folder.

handlers:

- url: /(.+)
  mime_type: text/html
  static_files: static/\1.html
  upload: static/(.+)

Meaning it will match all and look up static folder with .html extension if you want specific files you can do

- url: /(hello|world)
  mime_type: text/html
  static_files: static/\1.html
  upload: static/(.+)

means files hello.html and world.html only, to avoid handling all urls.

Smack answered 26/11, 2013 at 15:2 Comment(5)
Thanks it is working now without the .html !! The issue now is that it is not fetching the images or the css. My app.yaml is as follows: - url: /(.+) mime_type: text/html static_files: static/\1.html upload: static/(.+) - url: /(.*\.xml) mime_type: application/xml static_files: static/\1 upload: static/(.*\.xml) - url: /imagenes static_dir: static/imagenes - url: /css static_dir: static/css - url: /js static_dir: static/js - url: /static static_dir: static # site root - url: / static_files: static/index.html upload: static/index.htmlUnlicensed
Ok, i figuerd it out!! Just inverting the order, and adding your suggestion at the end of the file it allows to get the dir for the css, images and js first. Thank you very much!Unlicensed
I had an issue with this not working and it was just because I put a hyphen in one of the options -- i.e. /(hello|some-thing)Irrelevance
Could you please explain what is the \1 in static/\1.html for?Davon
\1 means first group in regex, if there were 2 groups in - url like (hello|world)/(abc|def) then \1 is hello or world and \2 is abc or def.Smack
Z
0

If you are looking at removing the file, I do not think you can directly do that via the Administration Console or any utility.

You will need to remove the files from your local project and then upload the same again.

Zeus answered 26/11, 2013 at 7:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.