homepage Welcome to WebmasterWorld Guest from 54.198.148.191
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
.htaccess with Directory Exception
How to tell .htaccess to not handle specific directories
wfernley




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

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

 

jdMorgan




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

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

RewriteCond %{REQUEST_URI} !^/testdir/

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved