Webmastersite.net
Register Log In

Redirect entire site

Comments on Redirect entire site

webflair
Forum Regular

Usergroup: Customer
Joined: Nov 27, 2006

Total Topics: 187
Total Comments: 465
Posted Jun 16, 2010 - 2:45 PM:

I need some advice on this because although I could probably do it after a bit of experimenting, it is really important I get it right first time.

I am moving a site from adomain.co.uk to adomain.com

I have decided to start listing businesses outside the UK, so I am changing to .com

How do I do a permenant htaccess 301 redirect so that all of my pages will redirect to the new domain correctly?



Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jun 16, 2010 - 4:11 PM:

Each page needs to redirect to the same page on the other domain? This might work, haven't tested:
Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.+)\.(.+)
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.