Forum Moderators: phranque
RewriteEngine on
RewriteCond %{REQUEST_URI}!^/viewArtUrl\.php
RewriteCond %{REQUEST_URI}!\.jpg$
RewriteCond %{REQUEST_URI}!\.css$
RewriteCond %{REQUEST_URI}!\.gif$
RewriteCond %{REQUEST_URI}!\.swf$
RewriteCond %{REQUEST_URI}!\.inc$
RewriteCond %{REQUEST_URI}!\.html$
RewriteCond %{REQUEST_URI}!\.xml$
RewriteCond %{REQUEST_URI}!\.mp3$
RewriteRule ^([^/]+)/? viewArtUrl.php?siteurl=$1 [L]
Basically I had to add every file extension up there for anything to work , but I'm sure there is a way around all this right (referring to having to list every file extension found in the directory)? There are a lot of other file extensions I didn't add, because I'm sure there is a way around adding all of those. But basically when I didn't have .css$ listed, then that was broken. I KNOW there is a way around it, but I'm not hip to it. Thanks.
I hesitate to move this thread to our Apache forum [webmasterworld.com] yet because it is very unclear where you are at and where you desire to be. Can you explain in more detail what you are attempting to accomplish? Is anything here PHP related?
In your case, you are telling mod_rewrite NOT to rewrite a set of URLs, based on the file extension. You might be able to reduce the size and complexity of the code by telling it what *to* rewrite instead.
Once the URLs are analyzed and a concise way to identify whether they should be rewritten is identified, then coding is the easy part.
Take a look at the entire URL-space of your site, and figure out what URLs you do and don't want rewritten to viewArtUrl.php, and how to easily identify them. Then the rest is just a few lines of code.
Jim