Welcome to WebmasterWorld Guest from 50.17.16.177

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

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

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

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Oct 25, 2006
posts:995
votes: 0


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.

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

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


In what way does it not work?

You probably need

RewriteEngine On
too.

^(.*)$
simplifies to
(.*)
3:29 pm on Dec 12, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Oct 25, 2006
posts: 995
votes: 0


Can you put all code? I'm new to this.thank you
4:56 pm on Dec 12, 2008 (gmt 0)

Senior Member from GB 

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

joined:Nov 27, 2001
posts:1156
votes: 2


this works for me:

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

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

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


^(.*)$
simplifies to
(.*)
4:40 pm on Dec 13, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Oct 25, 2006
posts:995
votes: 0


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

Senior Member from GB 

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

joined:Nov 27, 2001
posts:1156
votes: 2


scanned the post without sufficient caffeine!

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

thanks g1smd, will give that a try

any performance benefits?