httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krist van Besien <>
Subject Re: [users@httpd] mod rewrite issue
Date Thu, 19 Mar 2009 11:06:48 GMT
On Wed, Mar 18, 2009 at 9:05 PM, Johnny Edge <> wrote:
> Hello,
> I have a Virtual host that utilizes mod rewrite in the following manner
> <VirtualHost>
> ...
> RewriteEngine On
> RewriteRule ^(.*) /notfound.php?%{QUERY_STRING}
> i.e. missing documents are passed to notfound.php
> I also have a directory inside the VH which I want to pass such requests to
> a different script
> <Directory "/var/www/html/info/admin/">
>  AuthName "Restricted"
>   NTLMAuth on
>   NTLMAuthHelper "/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp"
>   NTLMBasicAuthoritative on
>   AuthType NTLM
>   require valid-user
> RewriteEngine On
> RewriteRule ^admin/(.*) /admin/index.php?%{QUERY_STRING} [L]
> </Directory>
> Still, http://info/admin/nonexistent will call notfound.php and not
> admin/index.php


RewriteRule ^/info/admin/(.*) /admin/index.php?%{QUERY_STRING} [L]

And make sure that this is put _before_ the other RewriteRules, as it
needs to match first. It is not necessary to put this in a <Directory>
(RewriteRule processing takes place before the URL -> Filename
translation, so directives in <Directory> blocks are probably even
ignored here)

Also, as you are not doing any query string mangling you can write
your RewriteRule as:
RewriteRule ^/info/admin/(.*) /admin/index.php [QSA,L]


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:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message