I uploaded my webpage using google app engine and it is working fine. It is a very simple webpage with 6 static files (.html all of them)
I need to Remove .html extension from URL.
For example: I have www.example.com/contact.html, I want www.example.com/contact
My current app.yaml is
runtime: php55
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: website/index.html
upload: website/index.html
- url: /
static_dir: website
All html files are Inside the "Website" folder, so how can i hide .html extension from URL
So Please help me to fix it.
If you have just 6 static files and you do not want to use .htaccess, you have to do this:
Instead of
> handlers:
>
> - url: / static_dir: website
You could:
handlers:
- url: /
static_files: website/index.html
upload: website/index.html
- url: /file1
static_files: website/file1.html
upload: website/file1.html
- url: /file2
static_files: website/file2.html
upload: website/file2.html
- url: /file3
static_files: website/what_ever_name.what_ever_format
upload: website/what_ever_name.what_ever_format
You could try something like this, but you'll have to not rely on the existing catch-all static_dir
handler you have at the end, since that will never be reached due to the new catch-all handler expanding any other file pattern with a .html
extension:
handlers:
- url: /
static_files: website/index.html
upload: website/index.html
# handler for specifically requested .html files
- url: /(.*\.html)$
static_files: website/\1
upload: website/.*\.html$
# add any other more specific file patterns here, before the catch-all case below
# catch-all handler implicitly serving .html files, no handler below it will be reached
- url: /(.*)$
static_files: website/\1.html
upload: website/.*\.html$
# no other handler from this point forward will be reached
Side note: overlapping handler url patterns for static_dir
and static_files
may cause problems, see Static files are missing