Solved

Rewrite rule exclusion problem

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

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…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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