You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by John Walton <li...@gmail.com> on 2009/01/17 00:57:50 UTC
[users@httpd] Mod_Rewrite rules and inheritance
Hi,
I'm having problems inheriting some of the rewrite rules that I created for
a group of web sites. I have a number of vhosts located under a /www
directory. For example:
/www/www.vhost1.org/
/www/www.vhost2.org/
/www/www.vhost3.org/
....
I am trying to define a few URL rewrite rules some of which apply to all of
the vhosts and some of which only apply to an individual site. I started by
putting all of the common rules in the Apache httpd.conf as follows:
<Directory /www>
Options +FollowSymlinks
RewriteEngine On
RewriteRule /foo$ /index.php?page=foo [nocase,redirect,last]
</Directory>
I tested this configuration and the alias worked on all of the vhosts. I
then tried to put the individual rules in a site's .htaccess file. For
example, in /www/www.vhost1.org/.htaccess:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^bar$ /index.php?page=bar [nocase]
I then found that this new alias on vhost1 (www.vhost1.org/bar) worked fine
but the rule in httpd.conf (www.vhost1.org/foo) no longer did. The
.htaccess rule appears to be clobbering the one in httpd.conf for vhost1.
The "/foo" alias still workesfine for the other vhosts. I tried using the
"RewriteOptions Inherit" directive in both .htaccess and httpd.conf with the
hope of having the rule from one inherit from the other but to no avail.
Any suggestions would be greatly appreciated. I'm running Apache 2.2 on
Fedora.
Thanks in advance for your help.
John
Re: [users@httpd] Mod_Rewrite rules and inheritance
Posted by Krist van Besien <kr...@gmail.com>.
On Sat, Jan 17, 2009 at 12:57 AM, John Walton <li...@gmail.com> wrote:
> Thanks in advance for your help.
Add:
RewriteOptions Inherit
To your vhost config.
Krist
--
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?
---------------------------------------------------------------------
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