Web Servers General Talk - Apache with multiple Rewrite Conds & Rules question

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers General Talk > June 2004 > Apache with multiple Rewrite Conds & Rules question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Apache with multiple Rewrite Conds & Rules question
dk_sz

2004-06-07, 7:51 am

2 questions:

1)
Am I correct in that [L] is only "used" if Apache matches and executes the
RewriteRule associated?


2)
Given above - shouldn't underneath work?
(it doesn't - if I simply enter domain-address, Apache/browser starts
endless redirect loop)

RewriteCond %{REQUEST_URI} !products/general-faq\.php$
RewriteCond %{http_REFERER} lamme-cracks\.org [NC,OR]
RewriteCond %{http_REFERER} lamme-crackz\.com [NC,OR] # comment
RewriteCond %{http_REFERER} lamme-crack\.net [NC,OR]
RewriteCond %{http_REFERER} (cracks|crackz|serials|serialz|warez) [NC]
RewriteRule .*\.(jpg|gif|png|bmp|exe|zip)$ - [NC,F,L]
RewriteRule .* /products/general-faq\.php [R,L]


What I want is: When a request comes from crack-referer.. Then Apache
Response:
* If request to a picture etc.: Forbidden!
* If request to a page: Redirect to FAQ!



best regards
Thomas


dk_sz

2004-06-07, 11:48 pm

Solution was:

SetEnvIfNoCase REFERER "yourregex" yourvar=yourvalue
SetEnvIfNoCase REFERER "(cracks|crackz|serials|serialz|warez)"
OV_BAD_REFERER=true
RewriteCond %{ENV:OV_BAD_REFERER} true
RewriteRule .*\.(jpg|gif|png|bmp|exe|zip)$ - [NC,F,L]
RewriteCond %{ENV:OV_BAD_REFERER} true
RewriteRule !products/general-faq\.php /products/general-faq\.php [R,L]


best regards
Thomas


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com