Solved

Rewrite rule exclusion problem

Posted on 2003-12-10
5
396 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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