Previous Thread
Next Thread
Print Thread
Rate Thread
using .htaccess to redirect an entire domain #285650
06/25/2005 3:04 PM
06/25/2005 3:04 PM
Joined: Aug 2002
Posts: 113
Sin City
M
Mudpuppy Offline OP
Journeyman
Mudpuppy  Offline OP
Journeyman
M
Joined: Aug 2002
Posts: 113
Sin City
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?

Sponsored Links
Re: using .htaccess to redirect an entire domain [Re: jbiz] #285651
06/25/2005 4:07 PM
06/25/2005 4:07 PM
Joined: May 2001
Posts: 562
Austria
A
Anno Offline
Code Monkey
Anno  Offline
Code Monkey
A
Joined: May 2001
Posts: 562
Austria
Use this:

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

Re: using .htaccess to redirect an entire domain [Re: domain123] #285652
06/25/2005 4:22 PM
06/25/2005 4:22 PM
Joined: May 2001
Posts: 562
Austria
A
Anno Offline
Code Monkey
Anno  Offline
Code Monkey
A
Joined: May 2001
Posts: 562
Austria
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 /

Re: using .htaccess to redirect an entire domain [Re: domain123] #285653
06/26/2005 2:39 AM
06/26/2005 2:39 AM
Joined: Aug 2002
Posts: 113
Sin City
M
Mudpuppy Offline OP
Journeyman
Mudpuppy  Offline OP
Journeyman
M
Joined: Aug 2002
Posts: 113
Sin City
[]Anno said:
Use this:

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

I used this one, and it worked perfectly. Thanks so much!

Re: using .htaccess to redirect an entire domain [Re: jbiz] #285654
06/26/2005 3:22 AM
06/26/2005 3:22 AM
Joined: May 2001
Posts: 562
Austria
A
Anno Offline
Code Monkey
Anno  Offline
Code Monkey
A
Joined: May 2001
Posts: 562
Austria
You're welcome.

Sponsored Links

Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with, and recommend, the following Web Hosts:
· Stable Host
· Blue Host
· Interserver.net
Visit Us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,938
Joined: January 2000
Show All Member Profiles 
Forum Statistics
Forums64
Topics37,448
Posts293,484
Members13,793
Most Online1,498
Mar 17th, 2017
Top Posters(All Time)
AllenAyres 25,587
JoshPet 11,330
Rick 8,373
LK 7,396
Lord Dexter 6,503
Gizmo 5,938
Greg Hard 5,533
Top Posters(30 Days)
isaac 4
Today's Statistics
Currently Online 713
Topics Created 0
Posts Made 0
Users Online 1
Birthdays 22
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2018 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.6.2
(Preview build 20180622.dev)
Page Time: 0.033s Queries: 15 (0.011s) Memory: 3.2496 MB (Peak: 3.3937 MB) Zlib enabled. Server Time: 2018-06-22 16:59:36 UTC