Htaccess redirects everything except the index page

I removed the blog from my domain and instead posted a simple index.html. How to redirect all incoming traffic so that it does not display 404 error, but redirects to the index?

I tried this, but it loops ...

RewriteEngine on
RewriteRule ^(.*)$ /index.html [L,R=301]
+3
source share
2 answers

Try:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.html
RewriteRule ^(.*)$ /index.html [L,R=301]

As you said, this does not work, I would try:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/aaa.html
RewriteRule ^(.*)$ /aaa.html [L,R=301]

index.html is the common default file name, so there may be rules that are at the server level, and not in your .htaccess. It depends on the server settings.

+7
source

Try to add

Options +FollowSymLinks -MultiViews -Indexes

at the very top and try.

0
source

Source: https://habr.com/ru/post/1774693/


All Articles