Forum Moderators: phranque

Message Too Old, No Replies

Cannot Access Folder

Issues with .htaccess prevents folder access

         

FlipFlops

4:53 pm on Feb 1, 2006 (gmt 0)



I have the following entry on my domains .htacess:
RewriteRule ^(.*)/(.*)/(.*).php$ /product.php?NAME=$1&BRAND=$2&SKU=$3 [L]

Right now, I'm setting up phpBB2 on the server, and the when I try to access the following URL, it's intercepted by the rewrite rule:

domain_com/phpBB2/admin/admin.php

Is there any way to tell the .htaccess file to NOT apply the rules to one specific sub folder on the server?

jdMorgan

5:01 pm on Feb 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure, use a RewriteCond to add an additional condition to the Rule:

# Exclude /pbpBB2 subdir
RewriteCond $1 !^phpBB2$
RewriteRule ^([^/]+)/([^/]+)/([^.]+)\.php$ /product.php?NAME=$1&BRAND=$2&SKU=$3 [L]

I also escaped the literal period in the rule pattern and changed the three subpatterns to much more specific (and much, much more efficient/faster) forward-looking negative-match patterns.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim