mod_rewrite subrequests or last rules within <Directory>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi. My goal was: if URI contains cuckoo, no matter what cookies, then
show /index.php. Otherwise if the user hasn't got BREEZESESSION cookie
set, then show /set_cookie.php.

I've got it working inside <VirtualHost> but outside <Directory>:
<VirtualHost *:80>
    ServerAdmin peterk@xxxxxxxxxxxx
    DocumentRoot
"/Users/peterk/demo_project/connect.mytbwa.com/test/proxy.server"
    ServerName proxy.server
    ErrorLog "/private/var/log/apache2/proxy.server-error_log"
    CustomLog /private/var/log/apache2/proxy.server-access_log common
	RewriteLog "/private/var/log/apache2/proxy.server-rewrite_log"
	RewriteLogLevel 9
	
     <Directory
"/Users/peterk/demo_project/connect.mytbwa.com/test/proxy.server">
         Order allow,deny
         Allow from all
	</Directory>
		   RewriteEngine on
		
		   RewriteCond %{REQUEST_URI} cuckoo [nocase]
		   RewriteRule (.*) /index.php?%{QUERY_STRING} [L]

		   RewriteCond %{HTTP_COOKIE} !BREEZESESSION [nocase]
		   RewriteRule (.*) /set_cookie.php?$1 [L]
   	
</VirtualHost>

But I couldn't get it work inside <Directory> - the config below. If I
request /cuckoo with no cookie, then I get /set_cookie.php. The
rewriter log says it rewrites to /index.php first (1st rule) and then
it rewrites it to /set_cookie.php (2nd rule). I thought [L] and [NS]
should stop any further rules. What am I missing?

I'm getting these results on Mac OS X and SUSE SLES running Apache 2,
mod _rewrite, mod_proxy and mod_php.

Best regards,
- Peter

The failing configuration:

<VirtualHost *:80>
    ServerAdmin peterk@xxxxxxxxxxxx
    DocumentRoot
"/Users/peterk/demo_project/connect.mytbwa.com/test/proxy.server"
    ServerName proxy.server
    ErrorLog "/private/var/log/apache2/proxy.server-error_log"
    CustomLog /private/var/log/apache2/proxy.server-access_log common
	RewriteLog "/private/var/log/apache2/proxy.server-rewrite_log"
	RewriteLogLevel 9
	
     <Directory
"/Users/peterk/demo_project/connect.mytbwa.com/test/proxy.server">
         Order allow,deny
         Allow from all
		   RewriteEngine on
		
		   RewriteCond %{REQUEST_URI} cuckoo [nocase]
		   RewriteRule (.*) index.php?%{QUERY_STRING} [L]
		
		   RewriteCond %{HTTP_COOKIE} !BREEZESESSION [nocase]
		   # NS = nosubreq - made no difference in the following
		   RewriteRule (.*) set_cookie.php?$1 [NS,L]
	</Directory>
</VirtualHost>

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux