Forum Moderators: phranque

Message Too Old, No Replies

How to permanently redirect mydomain.com to WWW.madomain.com?

         

toplisek

7:43 pm on Dec 11, 2008 (gmt 0)

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



I would like to know hiw is correct code to permanently redirect to

RewriteCond %{HTTP_HOST} ^mydomain\.com
RewriteRule ^(.*)$ [mydomain.com...] [R=permanent,L]

This code does not work.

g1smd

7:47 pm on Dec 11, 2008 (gmt 0)

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



In what way does it not work?

You probably need

RewriteEngine On
too.

^(.*)$
simplifies to
(.*)

toplisek

3:29 pm on Dec 12, 2008 (gmt 0)

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



Can you put all code? I'm new to this.thank you

diddlydazz

4:56 pm on Dec 12, 2008 (gmt 0)

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



this works for me:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]

g1smd

7:52 pm on Dec 12, 2008 (gmt 0)

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



^(.*)$
simplifies to
(.*)

toplisek

4:40 pm on Dec 13, 2008 (gmt 0)

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



Thank you

diddlydazz

4:56 pm on Dec 13, 2008 (gmt 0)

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



scanned the post without sufficient caffeine!

^(.*)$ simplifies to (.*)

thanks g1smd, will give that a try

any performance benefits?