CapIsland CapIsland - 3 months ago 21
PHP Question

RewriteCond exclude folder

I have the following in my .htaccess:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L]


This works nicely, but I don't want the RewriteRule to trigger for the following folder and its subfolders.

www.site.co.uk/Content


How do I do this?

Answer

Try this Rule,

RewriteEngine on
RewriteRule ^(content)($|/) - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L]

or create a .htaccess in content directory and put

RewriteEngine off