Solved

Rewrite rule exclusion problem

Posted on 2003-12-10
5
390 Views
Last Modified: 2006-11-17
I am using a cms (eZ Publish) which requires all requested uri's to be passed through the index.php file to allow the creation of user friendly urls.  I have this portion of the rewrite rule working fine.  I would howver like to exclude certin uri's from the request.  Namely the /awstats directory for viewing websats and the /webmail directory for picking up web based email.  I am attempting to get the /awstats part working with the following rules:

RewriteCond %{REQUEST_URI} ^/awstats.*
RewriteRule ^(.+) - [L]
RewriteRule !\.(gif|css|jpg|png|jar|jpeg|js|swf)$ /home/.sites/90/site11/web/index.php [L]

But only the last rule appears to be working, any changes to the condition and the first rule appear to have no affect.  Thanks in advance for any help.
0
Comment
Question by:wardjame
  • 2
5 Comments
 
LVL 27

Expert Comment

by:BigRat
Comment Utility
RewriteCond %{REQUEST_URI} !^/(awstats|webmail)/.*$
RewriteRule !^(.*)\.(gif|css|jpg|png|jar|jpeg|js|swf)$ /home/.sites/90/site11/web/index.php [L]

I hope.

0
 

Author Comment

by:wardjame
Comment Utility
I got it working.  Here is what I used:

RewriteRule ^/awstats/(.*) - [PT,L]
RewriteRule ^/awstats-cgi/(.*) - [PT,L]
RewriteRule ^/webmail/(.*) - [PT,L]
RewriteRule ^/openwebmail-cgi/(.*) - [PT,L]
RewriteRule ^(.+)\.(gif|css|jpg|png|jar|jpeg|js|swf)$ - [PT,L]
RewriteRule ^(.+) /home/.sites/90/site11/web/index.php [T=application/x-httpd-php,L]
0
 
LVL 27

Expert Comment

by:BigRat
Comment Utility
Hmmm.  The PT (=Pass Through) and L (=Last) options seem to be in conflict and it seems that it accepts L(ast) first. Change the [PT,L] into just [L]. You really ought to end your expressions with a $ sign. Whether you rewrite with identity or exclude with a condition (which is what you asked for in your question) is a matter of taste. The Identity rewrite is probably less cryptic, particularly if one added a bit of comment. In any event I'm glad it works.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now