Solved

Rewrite rule exclusion problem

Posted on 2003-12-10
5
394 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

807 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