exclude certain directories from .htaccess rewrite rules

New to mod_rewrite? This is a good place to start.

exclude certain directories from .htaccess rewrite rules

Postby Sewdn » Tue Jun 02, 2009 7:35 am

Hi,

i want to exclude certain directories from the list of rewriterules that i wrote in my .htaccess file.
Since this is a condition that has to be tested before rewrites begin i write at the top of my .htaccess:

RewriteCond %{REQUEST_URI} !^galleryadmin.*

This way i hoped that any url starting with galleryadmin would not be rewrited, but it didn't work.

Could anyone help with this problem?
Sewdn
 
Posts: 1
Joined: Tue Jun 02, 2009 7:29 am

Postby richardk » Tue Jun 02, 2009 11:00 am

%{REQUEST_URI} contains everything after the domain name up to the query string, including the first /.

You want
Code: Select all
RewriteCond %{REQUEST_URI} !^/galleryadmin(/.*)?$
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 117 guests

cron