Forum Moderators: phranque

Message Too Old, No Replies

Sending mydomain.tld to www.mydomain.tld

         

Karma

10:33 pm on Apr 26, 2007 (gmt 0)

10+ Year Member



Hey all :)

Can someone please tell me the best way to 301 traffic from

[mydomain.tld...]

to

[mydomain.tld...]

Many thanks

jay5r

11:16 pm on Apr 26, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



This will do it...

RewriteEngine On
RewriteCond %{HTTP_HOST}!^www\.mydomain\.tld$
RewriteRule ^(.*)$ [mydomain.tld$1...] [R=301,L]

[Don't know why, but it keeps taking out the space before the exclamation mark - make sure you put it back in...]

Karma

8:58 am on Apr 27, 2007 (gmt 0)

10+ Year Member



Thanks jay5r, worked great :)

g1smd

1:06 am on Apr 28, 2007 (gmt 0)

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



There are several other things that you might want to consider tidying up if you are looking at canonicalisation issues.

Browse back through the last few months posts and you'll find many other gems of code that will do things that you never realised you needed until you stumbled over them.