You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Asai <as...@globalchangemusic.org> on 2011/02/08 20:56:00 UTC

[users@httpd] Global 301 Redirects

Greetings,

I'm trying to figure out a way to have each of my vhosts do a 301 
redirect upon receiving a request which contains "www."

Basically we want to drop all of those www subdomains for SEO purposes, 
but we are hosting dozens of websites, and would rather not have to put 
in a redirect on every vhost entry.  My thought were that we could do 
this using mod-rewrite and regexp, but not sure.

Any insights?

Thanks.

-- 
--asai


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Global 301 Redirects

Posted by Asai <as...@globalchangemusic.org>.
Thank you for your response.  Much appreciated.

--asai


On 2/9/2011 10:45 AM, Igor Galić wrote:
>
> ----- Original Message -----
>> Greetings,
>>
>> I'm trying to figure out a way to have each of my vhosts do a 301
>> redirect upon receiving a request which contains "www."
>>
>> Basically we want to drop all of those www subdomains for SEO
>> purposes,
>> but we are hosting dozens of websites, and would rather not have to
> Really? Just dozens?
>
>> put
>> in a redirect on every vhost entry.  My thought were that we could do
>> this using mod-rewrite and regexp, but not sure.
> Anyway... Sure you could use mod_rewrite to complicate your config
> even more -- as, with dozens! of vhosts you're afraid of touching them
>
> But even then you'd have to add, at least:
>
> RewriteEngine On
> RewriteOptions inherit
>
> to each vhost.
>
>> Any insights?
> Now, instead of complicating things, why not take a shot at simplifying
> it with mod_macro:
> http://www.cri.ensmp.fr/~coelho/mod_macro/
>
>> Thanks.
>>
>> --
>> --asai
> i
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Global 301 Redirects

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> Greetings,
> 
> I'm trying to figure out a way to have each of my vhosts do a 301
> redirect upon receiving a request which contains "www."
> 
> Basically we want to drop all of those www subdomains for SEO
> purposes,
> but we are hosting dozens of websites, and would rather not have to

Really? Just dozens?

> put
> in a redirect on every vhost entry.  My thought were that we could do
> this using mod-rewrite and regexp, but not sure.

Anyway... Sure you could use mod_rewrite to complicate your config
even more -- as, with dozens! of vhosts you're afraid of touching them

But even then you'd have to add, at least:

RewriteEngine On
RewriteOptions inherit

to each vhost.

> Any insights?

Now, instead of complicating things, why not take a shot at simplifying
it with mod_macro:
http://www.cri.ensmp.fr/~coelho/mod_macro/
 
> Thanks.
> 
> --
> --asai

i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org