L
L
Lokeren2019-08-08 18:02:34
htaccess
Lokeren, 2019-08-08 18:02:34

.htaccess How to REDIRECT all but the main one?

Good afternoon.
On the site https://site.ru it is not possible to use the position
Redirect 301 from a page without .html to a page with .html

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)$ /$1.html [R=301,L]

because then the main page also falls under this redirect.
Tell me how to make a redirect for all https://site.ru/page1 to https://site.ru/page1.html
EXCEPT MAIN https://site.ru

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-08-08
@dodo512

You can add a condition , although this is not necessary as it already provides an exception for the main. RewriteCond %{REQUEST_URI} !^/$RewriteRule ^([^.]+)$

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question