Answer the question
In order to leave comments, you need to log in
How to hide .html in the address bar for a website page (no methods work)?
I have a website morozov.one. I don't use any CMS.
While the site is not filled with content. Created html pages for testing.
The htaccess file is currently empty.
Info on my server (I use shared hosting):
gladys.timeweb.ru/phpinfo.php
Here are my pages:
www.morozov.one/index.html
www.morozov.one/pages/index.html
www.morozov.one /pages/www/within-www-1.html
What I need:
1. If I enter the address of a page with the .html extension into the address bar, then after pressing enter, the address of the page WITHOUT html at the end should be displayed in the address bar.
This is how it should be displayed:
www.morozov.one/index
www.morozov.one/pages/index
www.morozov.one/pages/www/within-www-1
2. If I enter the address of the page WITHOUT the .html extension in the address bar, then the address should not change.
Tried everything from here:
https://github.com/phanan/htaccess#alias-clean-urls
stackoverflow.com/questions/5730092/how-to-remove-...
NOTHING works! I enter www.morozov.one/pages/www/within-www-1.html
, but after pressing enter the address does not change! I enter www.morozov.one/pages/www/within-www-1
- an error 404 occurs
Tried in different browsers. Tried clearing browser cache and cookies.
Help what to do?
Answer the question
In order to leave comments, you need to log in
I did it on .htaccess here is not a bad lesson https://www.youtube.com/watch?v=hw1XafRe5R0 and in general to rummage around YouTube by entering "Creating human-readable URLs" and it will give out a lot of manuals. From the lesson you will understand how to manage .htaccess and concoct your own urls.
In order for all html files without extension to be opened, add the following code to the site's .htaccess file:
DefaultType text/html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question