Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.

redirecting whole site (incl. internal pages)

Status
Not open for further replies.
Joined
Jan 19, 2007
Posts
2,208
Reaction score
47
Can anyone confirm the best way to redirect all traffic to a new site (including internal pages of the old to internal pages of the new)? The sites have the same structure:

oldsite.co.uk/forum/thread.php?234
newsite.co.uk/forum/thread.php?234

I've searched the forum and web and the closest I've come is this (and added to the .htaccess of the origination site):
HTML:
RewriteEngine on
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

Trouble is, it only seems to be working for the homepage to homepage redirect and not internal pages. Any help appreciated.
 
That would usually work as is for standard sub pages but if you want to pass through the query string variables you'll need to use QSA (query string append). Replace the flags at the end with [R=301,QSA,L] as opposed to just [R=301,L].
 
Thanks for the tip. Just tried it and no luck!
I'm not sure if something needs switching on, on the server...

With both sets of code, the homepage redirect works but no static links beyond the homepage nor any with query variables :( (I'm on hold with hostgator atm)
 
Where are you changing the .htaccess? If the homepage is redirecting solely perhaps the /forum/ directory has its own .htaccess which is overriding it?
 
Redemption you're the best. I took out the other htaccess. I didn't think the inside one would override it...

All working now! What do I owe you? lol
 
Redemption you're the best. I took out the other htaccess. I didn't think the inside one would override it...

All working now! What do I owe you? lol

haha the fact that one less person won't make the same mistake I have (countless times) is enough!
 
Yep - thanks again (I was on hold for ages with Hostgator and I still have the headache this thing gave me a couple of hours ago)
 
Thanks guys for the discussion. I also want to know the solution for the problem you are discussing earlier here. I used .htaccess file to redirect my ilead pk website to new one website ileaddigtal com website. The url structure was same in both websites hosted on same hosting space. I experienced the same problem. Only home page is redirecting, nothing the rest. I hope you will publish here also when you would have found anything about. Thanks in advance!
 
Try

Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(?:www\.)domain\.com$ [NC]
RewriteRule ^ http://newdomain.com%{REQUEST_URI} [L,R=301]
 
I have also issue with redirecting old website to new one. On old website we also have client projects which I do not want to redirect just want to redirect same pages. When apply 301 redirection all the same url worked well, but different url on old website become 404. How can I resolve this issue? I want to open project and other pages with old domain. Thanks
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Featured Services

Sedo - it.com Premiums

Sponsors

IT.com

Premium Members

AucDom
UKBackorder
Be a Squirrel

Sponsors

Acorn Domains Merch
MariaBuy Marketplace

Shiny Nuts

Perfect
Service
Laskos
URL Shortener
*the exceptional businesses of our esteemed moderators
Top Bottom