httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Evans <tevans...@googlemail.com>
Subject Re: [users@httpd] virtual hosts and rewrite rules
Date Fri, 22 May 2009 08:30:32 GMT
On Fri, 2009-05-22 at 06:32 +0000, Melanie Pfefer wrote:
> Hi
> 
> I have an apache instance where I defined several rewrite rules and ProxyPassReverse
that redirects to other web applications.
> 
> I added a virtual host in the conf file 
> 
> NameVirtualHost *:80
> <VirtualHost *:80>
> ServerAdmin you@example.com
> 
> DocumentRoot "/usr/local/apache2/htdocs"
> </VirtualHost>
> 
> RewriteEngine On
> RewriteRule ….
> 
> ProxyPass …
> ProxyPassReverse…
> 
> <VirtualHost *:80>
> ….
> </VirtualHost>
> 
> Now with this new virtual host, the rewrite rules are not working and I get broken links.
I had to comment all the VirtualHost settings.
> I thought that the rewrite rules will still work on the default virtual host but apparently
no.
> What is missing if I want the rewrite rules to affect the default virtual host?
> 
> thanks
> 
> 

If you have vhosts, then the default vhost is not what is specified
outside of the vhost tags, it is the first defined vhost in your conf
file. This means that any vhost level directives (like RewriteRules,
ProxyPass, Location blocks etc) must be defined inside a vhost container
to be relevant. Yours aren't, which is why they are ignored.

Cheers

Tom


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