Forum Moderators: phranque

Message Too Old, No Replies

Rewrite everything if NOT a certain directory?

         

kazisdaman3

12:15 am on Jun 24, 2007 (gmt 0)

10+ Year Member



Thanks for helping me, I've been trying to figure this out, and my friend for 2 hours now and just having trouble.

I currently have:

---

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule .* /index.php [L]

---

How to do the same ReWriteRule, but only doing it when the 1st folder is NOT a directory, like "testfolder".

IE: example.com/testfolder, do not apply rewrite rule to that directory, or anything following that directory, BUT have it do the rewrite for everything else?

Any suggestions? Thanks so much!

jdMorgan

1:42 am on Jun 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Simply add another RewriteCond:

RewriteCond %{REQUEST_URI} !^/testfolder

This condition requires that the requested URL-path NOT start with "/testfolder" in order for the rule to execute.

Flush your browser cache before testing any change to your .htaccess or server config files.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim