[lug] org net redirect or modrewrite to com

dio2002 at indra.com dio2002 at indra.com
Wed Aug 1 19:29:37 MDT 2007


> How do you want the sites to show up? If you want the exact same
> content to be replicated across multiple domains, you can use a
> ServerAlias rule inside your VirtualHost. If you use this rule,
> http://www.blah.com/random.html, http://www.blah.org/random.html, and
> http://www.blah.net/random.html all point to the exact same file.
>
> <VirtualHost *>
>         ServerName      www.blah.com
>         ServerAlias     www.blah.org www.blah.net
>
>         # VirtualHost rules continue here
> </VirtualHost>

i mentioned in another post that pure server alias is incompatible with my
backend app due to the way it handles the requests.  so to use this method
would require more work on the backend then i want to wrangle with.

> domains to one "canonical" domain name. (Among other things, server
> alias rules confuse cookies, since the cookie is stored using the host

yeah that's another good reason to rewrite or redirect.

> cookie won't be set.) In this example, requests for
> http://blah.com/random.html or http://www.blah.net/random.html will be
> redirected (302, but I think you can change that in the Redirect rule)
> to http://www.blah.com/random.html.
>
> <VirtualHost *>
>         ServerName      blah.com
>         ServerAlias     blah.org www.blah.org blah.net www.blah.net
>
>
> </VirtualHost>
> <VirtualHost *>
>         ServerName      www.blah.com
>
>         # VirtualHost rules continue here
> </VirtualHost>

works beautifully thanks..

note, you probably want to force the redirect to a 301 so it is flagged as
permanent versus temporary (302) which is the default for better seo.

Redirect 301 / http://www.blah.com




More information about the LUG mailing list