htaccess redirect everything except index page
I have removed the blog from my domain and put a simple index.html instead. How do I redirect all the incoming traffic so that it does not show a 404 error, but redirects to the index?
I tried this, but it loops...
RewriteEngine 开发者_如何学编程on
RewriteRule ^(.*)$ /index.html [L,R=301]
Try:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.html
RewriteRule ^(.*)$ /index.html [L,R=301]
As you mentioned that this doesn't work, I'd try:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/aaa.html
RewriteRule ^(.*)$ /aaa.html [L,R=301]
index.html is a general default file name, so there might be rules that are on the server level, not in your .htaccess. That depends on the server setup, though.
Try adding the
Options +FollowSymLinks -MultiViews -Indexes
at the very top and give it a try.
精彩评论