How to redirect www to non-www? e.g redirect www.example.com to example.com Thanks Johnny -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
If you use Apache as a web server, there are plenty of .htaccess tricks to do just that. Google around a bit. Aleksey On Jan 21, 2:02 pm, Johnny Shi <johnny.t....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How to redirect www to non-www? e.g redirectwww.example.comto > example.com > > Thanks > > Johnny-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Here is a virtual host definition for apache that does the other way
around, I am sure it you could adjust it for what you want. Bear in
mind you will need mod_rewrite available on your server. If you do
not have your own server then you usually have to implement this in
the .htaccess file as explained by Aleksey
<VirtualHost *:80>
ServerName www.example.co.uk
ServerAlias example.co.uk
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.co\.uk [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.example.co.uk/$1 [L,R]
RailsEnv production
RailsBaseURI /
<Directory /srv/www/vhosts/example/current/public>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from All
</Directory>
DocumentRoot /srv/www/vhosts/example/current/public
ErrorLog /var/log/apache2/example_production_error_log
TransferLog /var/log/apache2/example_production_access_log
LogLevel warn
</VirtualHost>
Hope that helps.
O.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule (.*)$ http://example.com/$1
On Jan 21, 5:02 am, Johnny Shi
<johnny.t....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> How to redirect www to non-www? e.g redirectwww.example.comto
> example.com
>
> Thanks
>
> Johnny
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
You can use this rack for your app:
http://coderack.org/users/trevorturk/entries/72-no-www
_______________________
Agustin Viñao
www.agustinvinao.com.ar
agustinvinao (Skype)
On Thu, Jan 21, 2010 at 8:51 AM, Eduard Martini
<eduard.martini-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:
> RewriteEngine on
> RewriteCond %{HTTP_HOST} ^www.domain.com$
> RewriteRule (.*)$ http://example.com/$1
>
> On Jan 21, 5:02 am, Johnny Shi
<johnny.t....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > How to redirect www to non-www? e.g redirectwww.example.comto
> > example.com
> >
> > Thanks
> >
> > Johnny
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.