Forum: Ruby on Rails RewriteRule to strip www. ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8f0cf2bd23a6abd922a654c17efee937?d=identicon&s=25 josh (Guest)
on 2006-05-26 17:14
I'm trying to add a RewriteRule to my .htaccess to remove the www.
prefix from requests. The following works on its own:

RewriteCond %{HTTP_HOST} www.mysite.com
RewriteRule (.*) http://mysite.com/$1

But it blows up when I try to add it to my .htaccess file. I've tried
moving it around, before and after the various Rails-specific rules, but
I can't get it to work.

Is it possible? Any suggestions?

Thanks!
Af72b502d277ea86637ba12c5056ec68?d=identicon&s=25 unknown (Guest)
on 2006-05-26 18:43
(Received via mailing list)
john gruber wrote on this a short while ago:
    http://daringfireball.net/2006/05/htaccess_redirection
This topic is locked and can not be replied to.