Skipping a entire directory using Helicon ISAPI rewrite v3.0
-
26-05-2021 - |
Question
Here is my current .htaccess file. This file is in my root directory for my site. I want to add a rule that in plain english will do the following.
COMPLETELY SHUT OFF RULES PROCESSING FOR http://www.sc-pa.com/dr405/*.*
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} (www.sarasotaproperty.net|www.sc-pa.net|sc-pa.net|sarasotaproperty.net) [nc]
#RewriteRule ^(.*)$ http://www.sc-pa.com/$1 [R=301,NC,QSA]
RewriteRule (.*)/eurl\.axd/[0-9a-f]+ /$1 [L]
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteCond %{REQUEST_URI} !.*(js|css|inc|jpg|gif|png)
RewriteRule (.*) ${lc:$1} [R=301]
RewriteCond %{REQUEST_URI} !.*(web_content/pdf/|/dr405/).*
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (?!.*/web_content/pdf/)([^/]*?\.pdf) /web_content/pdf/$1 [R=301]
RewriteRule pasite-(.*\.asp)$ /content/$1 [R=301,QSA]
RewriteRule home\.asp$ / [R=301]
#RewriteRule ^search/tpp/?$ content/search_tangible.asp
#RewriteRule ^search/?$ content/search_real_property.asp
#RewriteRule ^downloads/?$ content/downloads.asp
#RewriteRule ^(.*?view)/([^/]*)/([^/]*)(/.+)? /search/parcel_detail.asp?account=0&$2=$3 [NC,LP,QSA,R=301]
La solution 2
Moved the site to IIS7 and used the built in rewrite module.
Autres conseils
If you need to completely disable rewriting and .htaccess files for this directory and subdirectories you may use section in the HTTPD.CONF file. Here is an example:
<Directory C:/inetpub/mysite/dr405>
RewriteEngine off
AllowOverride None
</Directory>
Please note you need to use fully qualified path, i.e. C:/intepub...
If you simply want to exclude this directory so rules from current .htaccess file will not be applied you may place this rule at the beginning of your site's .htaccess file:
RewriteBase /
RewriteRule ^dr405 - [L]
RewriteCond %{HTTP_HOST} (www.sarasotaproperty.net|www.sc-pa.net|sc-pa.net|sarasotaproperty.net) [nc]
#RewriteRule ^(.*)$ http://www.sc-pa.com/$1 [R=301,NC,QSA]
RewriteRule (.*)/eurl\.axd/[0-9a-f]+ /$1 [L]
# ... etc....
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow