Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

migrated from Apr 9 '10 at 13:55

This question came from our site for professional and enthusiast programmers.

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]

share|improve this answer
please can you edit out the domain - i forgot :) – Andrew Apr 9 '10 at 10:40
Incidently I tried that just before your post with the same issue :( – Andrew Apr 9 '10 at 10:40
I'm using utf-8 as the .htaccess file type is that correct? – Andrew Apr 9 '10 at 10:41
still doesn't redirect but displays the original (old) page – Andrew Apr 9 '10 at 11:35
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 ) – Andy Shellam Apr 9 '10 at 11:50

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]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.