S
S
Sergey Kolesnik2020-04-29 06:10:52
htaccess
Sergey Kolesnik, 2020-04-29 06:10:52

How to change url name using htaccess?

Task: change the name of the site https://NameOfSite.com/index.html to https://NameOfSite.com/MainPage
And also change the name of internal pages For example https://NameOfSite.com/about.html to https:// NameOfSite.com/AboutUs
For this I tried to apply htaccess and this code. But even when entering the main page, it displayed a 404 error. But at the same time, the name turned out to be changed.
What is the problem?

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ https://NameOfSite.com/MainPage [R=301,L]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2020-04-29
@shambler81

1. the domain is case-insensitive don't mess around
2. Files and directories, on the contrary, are case-sensitive and you can't change them like this either ;), this is not Windows for you.
3. If you have a CNC site, then they are also usually case-sensitive, but if your CNC easily treats such tricks, then do it miserably in it.
4. Why Karl?
5. You can easily find a redirect from html to without it, all you need to do is add flag [NC] if you are really so attached, in which case the redirects will be case-insensitive.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question