Forum Moderators: phranque

Message Too Old, No Replies

Redirect http:// to http://www.

         

almo136

7:35 pm on May 5, 2009 (gmt 0)

10+ Year Member



Hi,

Does anyone now how I can redirect http:// to http://www.

So that http://example.com/whatever.html would be directed to http://www.example.com/whatever.html

Thanks.

[edited by: phranque at 9:20 pm (utc) on May 5, 2009]
[edit reason] exemplified urls [/edit]

phranque

9:19 pm on May 5, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



usually with a 301 Moved Permanently [w3.org] response.
what type of server?

almo136

9:27 pm on May 5, 2009 (gmt 0)

10+ Year Member



thanks phranque.

I actually just stumbled across a solution. I added this to my htaccess and it worked a treat:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

[edited by: phranque at 9:36 pm (utc) on May 5, 2009]
[edit reason] exemplified urls [/edit]