views:

28

answers:

1

I need to take down an entire site, so I want to route everything request to a landing page. What does the mod_rewrite look like for that? My directives are giving me a "can never complete" error in firefox.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^[^.]*/$
RewriteRule ^(.*)$ /alert.php [R=301,L]
A: 

The page you're redirecting to matches the rewrite pattern, so when the browser tries to request it as a result of the 301 redirect, it gets redirected again (causing an infinite loop, which Firefox is smart enough to notice). You'll want to add an exception to your rule to avoid this:

# the conditions are implicitly combined
# with a logical AND
RewriteCond %{REQUEST_URI} !=/alert.php
RewriteCond %{REQUEST_URI} !^[^.]*/$
RewriteRule ^(.*)$ /alert.php [R=301,L]
bosmacs
What does the mod_rewrite look like for that?
Dr. DOT
Thanks bosmacs.
Dr. DOT
Please accept this answer if it works for you.
bosmacs