Linode.com Forum Forum Index Linode.com Forum
Linode Community Forums
 


Apache rewrite question

Click here to go to the original topic

 
       Linode.com Forum Forum Index -> Linux, Apache, Mysql and PHP (LAMP) Forum
Author Message
jeff



Joined: 19 Apr 2004
Posts: 5

Posted: Mon Apr 19, 2004 11:23 pm    Post subject: Apache rewrite question  

Hello,

Does anyone have a snippet of an apache config file that demonstrates a simple rewrite rule for prepending the "www" portion to the domain name? I know the basics of apache configuration but the rewrite stuff (especially the regular expresions!) is very confusing to me.

I'm just trying to get mydomain.com to always load up in a browser as www.mydomain.com.

Thanks much,
Jeff
Back to top  
tgabi



Joined: 29 Mar 2004
Posts: 3

Posted: Tue Apr 20, 2004 11:47 am    Post subject:  

Hi,
you don't need rewrite for that. Rewrite is not recommended for security reasons. Do this in your apache config:

# yourdomain.com - redirect to www.yourdomain.com
<VirtualHost x.x.x.x>
ServerName yourdomain.com
ServerAdmin admin@yourdomain.com
Redirect / http://www.yourdomain.com/
</VirtualHost>
Back to top  
jeff



Joined: 19 Apr 2004
Posts: 5

Posted: Tue Apr 20, 2004 9:19 pm    Post subject:  

This is perfect!

Thanks much!
Back to top  
 
       Linode.com Forum Forum Index -> Linux, Apache, Mysql and PHP (LAMP) Forum
Page 1 of 1