Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Rewrite rule exclusion problem

Posted on 2003-12-10
5
Medium Priority
?
399 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
4 Comments
 
LVL 27

Expert Comment

by:BigRat
ID: 9927745
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
ID: 9928591
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
ID: 9937422
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
ID: 12152039
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
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 …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview
Suggested Courses
Course of the Month6 days, 2 hours left to enroll

772 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