PDA

View Full Version : DNS redirect from calguns.net to www.calguns.net


socalguns
03-01-2006, 4:01 AM
Hi.
Sometimes I visit calguns.net,
sometimes www.calguns.net,
and sometimes clicking a link in the forum
goes to one or the other (it may be a user created link),
effectively logging me out (cookies).

It would be nice if calguns.net
was always redirected to www.calguns.net
(or the other way around)
to avoid this (easier than making sure all the links are correct)

Since you're running apache, it should be simple as a rewrite rule
(with mod_rewrite.so) in your httpd.conf

http://httpd.apache.org/docs/1.3/misc/rewriteguide.html
so something like

RewriteCond %{HTTP_HOST} !^www\.calguns\.net [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.calguns.net/$1 [L,R]


Thanks