httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Spinassi <martins.li...@gmail.com>
Subject Re: [users@httpd] apache redirection does not work
Date Thu, 01 Oct 2009 21:06:42 GMT
On Thu, 2009-10-01 at 11:53 -0400, Sharjeel Tariq wrote:
> Hi,
> 
> 
> I am trying to set up apache redirection rule for redirecting all of
> our non
> 'www' domains to 'www' domains. I got the redirection rule from apache
> manual
> but the rule does not work when we have subdirectories and parameters
> at the
> end of url.
> 
> The redirection rule i have is 
> 
> 
> RewriteCond %{HTTP_HOST} ^example.com$
> RewriteRule ^/(.*)$ http://www.example.com/$1 [L,R]
> 
<snip>

Sharjeel,

I know it's not what you are asking for, but may accomplish your task.

You can try adding a ServerAlias to the VirtualHost:

ServerName example.com
ServerAlias www.example.com

Here is the documentation at apache site:
http://httpd.apache.org/docs/2.0/mod/core.html#serveralias


Sorry if it's not what you are asking for, but it's pretty much waht I'd
do. With a simple script you can manage to add the ServerAlias to all
the VirtualHosts.


Cheers,

Martin


---------------------------------------------------------------------
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


Mime
View raw message