KaLv1n K
KaLv1n K

Reputation: 131

disabled htaccess for selected directory

i have a htaccess code shown below:

RewriteEngine On
RewriteCond $1 !^/administrator
RewriteCond %{HTTP_HOST} ^localhost/host
RewriteRule (.*) http://localhost/host/$1 [R=301,L]
RewriteRule ^([-\w]+)?/?([-\w]+)?/?([-\w]+)?/?$ index.php?seg1=$1&seg2=$2&seg3=$3

but it still read the htaccess in administrator folder. is the code incorrect? Thanks.

Upvotes: 0

Views: 81

Answers (1)

Pekka
Pekka

Reputation: 449415

RewriteCond statements apply to one RewriteRule only.

You need to repeat your RewriteConds for the second rewrite rule (and use REQUEST_URI):

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/administrator
RewriteCond %{HTTP_HOST} ^localhost/host
RewriteRule (.*) http://localhost/host/$1 [R=301,L]

RewriteCond %{REQUEST_URI} !^/administrator
RewriteCond %{HTTP_HOST} ^localhost/host
RewriteRule ^([-\w]+)?/?([-\w]+)?/?([-\w]+)?/?$ index.php?seg1=$1&seg2=$2&seg3=$3

Upvotes: 1

Related Questions