This is giving me a 500 internal server error. Any suggestions? I have tried various examples but I think I'm missing something...
RewriteEngine On
RewriteCond %{request_uri}!^ /index\.htm
RewriteRule ^(.*) /index\.htm [R=permanent,L]
It displays the homepage if I navigate there but anything that meets the conditions (all appart from index.htm gives the server 500)
EDIT: with the above code it now doesnt give any 500 errors but it doesnt redirect for any pages
From serverfault
SocialAddict
-
You're not redirecting to
/index.htm
, you're redirecting to/
which is different as far as Apache is concerned.Try:
RewriteRule ^(.*)$ /index.htm [R=permanent,L]
SocialAddict : please can you edit out the domain - i forgot :)SocialAddict : Incidently I tried that just before your post with the same issue :(SocialAddict : I'm using utf-8 as the .htaccess file type is that correct?SocialAddict : still doesn't redirect but displays the original (old) pageAndy Shellam : What about capitalising REQUEST_URI? It might be case-sensitive, and in all the Apache documentation, those macros ARE IN CAPS (not shouting, just illustrating :-P )SocialAddict : tried that now too no luckFrom Andy Shellam -
Your rewrite condition isn't split up well and your Not-StartWith is part of the previous parameter. :) You need a space after the
%{REQUEST_URL}
and before the!^
RewriteEngine On RewriteCond %{REQUEST_URI} !^/index\.htm$ RewriteRule ^(.*) /index.htm [R=permanent,L]
From Amadiere
0 comments:
Post a Comment