I am hosting a static website with the Google Cloud Platform. I can't figure out how to remove the .html file extension from the URL. Ideally, I would like to have my url read "https://www.website.com/index"
I have tried using .htaccess files, but have not had any luck. I have seen people talking about using a file called "app.yaml", but I am still confused.
What is the best way to remove the .html file extension from a Google Cloud Platform URL?
I understand you want to remove the .html extension in the links found in the navigation of your site.
The way for you to serve the files as html (after removing the extension file) is to set the file's Content-Type metadata to "text/html".
For example in your Console > Bucket there's a "contact.html" file, perform the following steps:
- Click the three dots to the right most part of the list.
- Select the Rename option then rename the file to "contact".
- Click the three dots again and select the Edit metadata option.
- In the form you should see Content-Type field - type in text/html.
- Save the changes.
When accessing /contact link/URL, the file should now be served as HTML even after removing the .html extension.