Welcome to WebmasterWorld Guest from 54.162.157.249

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

.htaccess with Directory Exception

How to tell .htaccess to not handle specific directories

     
11:44 am on Dec 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey everyone,

Does anyone know how I can get my .htaccess file to control every directory within root except for specific directories that I specify.

Here is my current code:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTP_HOST}!^(www\.¦$) [NC]
RewriteRule ^ [%{HTTP_HOST}%{REQUEST_URI}...] [L,R=301]

# Change ---.php to ---.html
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule (.*) pages\.php?page=$1

I basically have every file being requested to go to pages.php unless the file actually exists. I have a directory (we will call it "testdir") which I want to exclude in the .htaccess file so when someone requests a file within the testdir directory, the .htaccess file does not try to forward it to pages.php.

Can anyone help?

Thanks in advance for your help!

Wes

2:20 pm on Dec 18, 2007 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Add a RewriteCond with a negative pattern to exclude that directory.

RewriteCond %{REQUEST_URI} !^/testdir/

Jim
 

Featured Threads

Hot Threads This Week

Hot Threads This Month