homepage Welcome to WebmasterWorld Guest from 54.197.171.109
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

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

Apache Web Server Forum

    
Excluding selected file extensions in a RewriteCond
designaweb




msg:1500144
 2:13 pm on Dec 22, 2002 (gmt 0)

I use the below code in a .htaccess file. With the middle 5 lines I exclude some file extensions, but is there a better way to do this?

RewriteCond %{REQUEST_URI} \/.+\/
RewriteCond %{REQUEST_URI}!.*\.css
RewriteCond %{REQUEST_URI}!.*\.jpg
RewriteCond %{REQUEST_URI}!.*\.gif
RewriteCond %{REQUEST_URI}!.*\.zip
RewriteCond %{REQUEST_URI}!.*\.js
RewriteRule ^(.*)/ cheats.php?action=showtitles&platform=$1 [L]

 

jdMorgan




msg:1500145
 5:40 pm on Dec 22, 2002 (gmt 0)

designaweb,

I'm not sure what you mean by "a better way", but you can make it more compact:

RewriteCond %{REQUEST_URI} \/.+\/
RewriteCond %{REQUEST_URI} !.*\.(css¦jpg¦gif¦zip¦js)
RewriteRule ^(.*)/ cheats.php?action=showtitles&platform=$1 [L]

(Remember to replace any broken vertical pipe "¦" characters in code posted on WebmasterWorld with a solid vertical pipe characters before use!)

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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved