homepage Welcome to WebmasterWorld Guest from 54.197.110.151
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

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

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3805417 posted 7:43 pm on Dec 11, 2008 (gmt 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.

 

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3805417 posted 7:47 pm on Dec 11, 2008 (gmt 0)

In what way does it not work?

You probably need RewriteEngine On too.

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

toplisek

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3805417 posted 3:29 pm on Dec 12, 2008 (gmt 0)

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

diddlydazz

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3805417 posted 4:56 pm on Dec 12, 2008 (gmt 0)

this works for me:

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

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3805417 posted 7:52 pm on Dec 12, 2008 (gmt 0)

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

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3805417 posted 4:40 pm on Dec 13, 2008 (gmt 0)

Thank you

diddlydazz

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3805417 posted 4:56 pm on Dec 13, 2008 (gmt 0)

scanned the post without sufficient caffeine!

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

thanks g1smd, will give that a try

any performance benefits?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved