...

URL Rewrite - but with exceptions

kcfried
02-09-2009, 08:39 PM
Hi all. Ok, here is the URL Rewrite I'm using right now:

RewriteEngine on
Options +FollowSymlinks
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?jvID=$1 [L]

And of course, this routes any subdirectory to index.php. It was initially set up because affiliates want to access the site like so:

www.thesite.com/affiliateName/

the index.php does hit the database and look up the "directory" and handles the data from there.

Now the client wants to add a blog at www.thesite.com/blog and of course, it's not routing correctly.

Is there a way I can use conditionals in the URL Rewrite to handle real directories? Apologies in advance - my RegEx skills are horrible.

Inigoesdr
02-10-2009, 02:48 AM
You can exclude real files and directories by placing a condition before your rule:

Options +FollowSymlinks

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?jvID=$1 [L]

kcfried
02-10-2009, 03:01 AM
Ahh, thanks VERY much!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum