Its all about Ruby On Rails
Redirect all traffic comming to domain.com to www.domain.com using apache mod_rewrite
You may want to redirect all visitors to coming to your domain “domain.com” to “www.domain.com”. Most popular way to do this is using apache’s mod_rewrite module. You just need to add few lines in your apache’s configuration file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com$1 [R=permanent,L]
| Print article | This entry was posted by Akhil Bansal on October 23, 2008 at 4:04 pm, and is filed under apache, mod_rewrite, redirect, rewrite. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 1 year ago
And if you need to do this for Passenger (which disables mod_rewrite by default), simply delete the Rails public/.htaccess file and then enable the RailsAllowModRewrite configuration parameter.
about 1 year ago
Hi Luke,
I found that setting RailsAllowModRewrite On works even if we don’t delete public/.htaccess