UBB.Dev
Posted By: Mudpuppy using .htaccess to redirect an entire domain - 06/25/2005 10:04 PM
I was going to direct this to Josh, but as he's out of town on one of his oh-so-frequent vacations , I hope it's okay to ask it here.

I'm currently modifying about 25 domains to comply with the new enforcement of the 2257 law (it's a law which applies to adult webmasters). Until I've finished modifying a domain, I'd like to redirect everything on that domain to another site which is already in compliance. I want to use a .htaccess file to do this, but the one I'm using currently isn't working correctly:

Redirect 302 / http://www.mytemporarysite.com/

I want the redirect to work on every page and subfolder and pages in subfolders on my old domain. I just want all 5000+ pages and subfolders on my old domain to ALL be redirected to the index page of www.mytemporarysite.com. As I've got it now, the .htaccess file is only redirecting the main index page of the domain, i.e. mycurrentsite.com/index.html. If I try to access any other page on that domain, I just get a 404 error.

So, is there a way to use .htaccess to force every single page on a domain to be redirected to a single page on another site, without listing every page or subfolder individually?
Posted By: Anno Re: using .htaccess to redirect an entire domain - 06/25/2005 11:07 PM
Use this:

RewriteEngine on
RewriteRule (.*) http://www.mytemporarysite.com/
Posted By: Anno Re: using .htaccess to redirect an entire domain - 06/25/2005 11:22 PM
A different approach would be to use your redirect:

Redirect 302 / http://www.mytemporarysite.com/

and on http://www.mytemporarysite.com/
you specify:

ErrorDocument 404 /
[]Anno said:
Use this:

RewriteEngine on
RewriteRule (.*) http://www.mytemporarysite.com/ [/]

I used this one, and it worked perfectly. Thanks so much!
Posted By: Anno Re: using .htaccess to redirect an entire domain - 06/26/2005 10:22 AM
You're welcome.
© UBB.Developers