Forum Moderators: phranque

Message Too Old, No Replies

Redirect Every Page to One Page

         

stevenmusumeche

9:09 pm on Nov 10, 2004 (gmt 0)

10+ Year Member



I'm trying to redirect every page to an error page. This will be used when a site is taken down for maintenance. I thought this would work, but it's not working:

RewriteEngine on
RewriteRule ^(.*)$ /custom/down.php

any ideas?

ogletree

9:12 pm on Nov 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There is no benefit on doing this. Just make a custom 404 page. It is the same thing as far as the se's are concerened. They will see lots of pages that are the same.

Just put
ErrorDocument 404 [domain.com...] in your .htaccess file

jdMorgan

9:42 pm on Nov 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do not use a canonical URL with ErrorDocument unless you want a 302-Found respsonse. See the Apache ErrorDocument documentation for details.

Use


ErrorDocument 404 /error.html

in your .htaccess file if you want to return a 404-Not Found status.

You might consider using mod_rewrite to set up two filespaces on your server that you can map your site's URLs to. Then you can leave the old site up in one filespace, upload the new site to the other filespace, and then change the mod_rewrite code to "instantly" switch all your URLs to point to the other (new site) filespace.

This works well for sites where the content is static, or dynamic sites where the content (database) is modified only by the administrators and not by users.

Jim