[Solved] MOD REWRITE that ignores a certain directory?

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

[Solved] MOD REWRITE that ignores a certain directory?

Post by Dale »

I know nothing is impossible in the world ofprogramming, though I've became stumped on the wonders that are .htaccess files. I have this following piece of code that makes http://www.someurl.com/something goto http://www.someurl.com/foo.php?bar=something

Code: Select all

Options +FollowSymLinks
RewriteEngine on
RewriteRule /(.*)$ /foo.php?bar=$1
However doing this makes all myimages (in /images/) disappear, because I suppose they're trying to be located in /foo.php?bar=images/some.jpg (he he) though is there a way that I can get it to not use MOD_REWRITE on the images folder yet still work for everything else?
Last edited by Dale on Tue May 22, 2007 4:26 am, edited 1 time in total.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Something similar to this

Code: Select all

RewriteCond %{REQUEST_URI} !/(names|of|directories|not|to|be|rewritten)/
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

ole wrote:Something similar to this

Code: Select all

RewriteCond %{REQUEST_URI} !/(names|of|directories|not|to|be|rewritten)/
Tried that, but doesn't seem to work. :/
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

before, try:

Code: Select all

RewriteRule ^folder_name/.*$ - [PT]
That should match your directory name and abort the rest of the rules.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Attempt 2:

Code: Select all

RewriteCond %{REQUEST_URI} !/(names|of|directories|not|to|be|rewritten)/.*
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

real life example that use:

Code: Select all

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/shop.* [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]  
RewriteCond %{REQUEST_FILENAME} -d        
RewriteRule ^(.+) - [PT,L]
it excludes a specific folder, a real existing folder or filename.
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

ole wrote:Attempt 2:

Code: Select all

RewriteCond %{REQUEST_URI} !/(names|of|directories|not|to|be|rewritten)/.*
Always gives me Internal Server Error (500). :/
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Well this works for me

Code: Select all

RewriteEngine On
RewriteCond %{REQUEST_URI} !/(style|gfx|script)/.*
RewriteRule .* bootstrap.php
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

I checked out Thread: 67177 and the example in their worked, plus your one did too ole. :)

Cheers.
Post Reply