Solved

Rewrite Cond

Posted on 2006-10-25
7
213 Views
Last Modified: 2010-05-18
Hi,

I have this rule...RewriteEngine on
RewriteRule ^([0-9a-zA-Z]+)[_]([0-9a-zA-Z]+)[_]([0-9a-zA-Z]+).*$ results.asp?kwds=$1+$2+$3
RewriteEngine on
RewriteRule ^([0-9a-zA-Z]+)[_]([0-9a-zA-Z]+).*$ results.asp?kwds=$1+$2


The problem is that it affects files like this...tp_general_highlight_on.gif which is an image file - unfortunately - i get this feed from else where so i cannot change the file name. What kind of condition can i set to ignore this file? and how can i set it?

Please help!
0
Comment
Question by:mrperfect75000
  • 4
  • 2
7 Comments
 
LVL 41

Accepted Solution

by:
HonorGod earned 500 total points
ID: 17808935
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !(.*).gif [NC]
RewriteRule ^([0-9a-zA-Z]+)[_]([0-9a-zA-Z]+).*$ results.asp?kwds=$1+$2
0
 

Author Comment

by:mrperfect75000
ID: 17809186

That makes sense but it seems to be searching for tp_general first -

i dont think the rule gets to the gif part - it gives me the same thing and seems to be trying to do this...results.asp?kwds=tp%20general...

any ides?
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 17814370
 Well, according to the way the rules are supposed to work, the Cond should occur after the Rule, and thus the transformation should not occur.  Interesting.
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 41

Expert Comment

by:HonorGod
ID: 17814397
you might try:

RewriteRule ^([0-9a-zA-Z]+)[_]([0-9a-zA-Z]+)*!(?gif)$ results.asp?kwds=$1+$2
0
 

Author Comment

by:mrperfect75000
ID: 17864231
It still gives me an Internal Error
0
 
LVL 27

Expert Comment

by:caterham_www
ID: 17966849
An other thing: Do you need .* at the end? Should foo_bar:foo result in results.asp?kwds=foo+bar?

Otherwise

RewriteEngine on
RewriteRule ^([0-9a-z]+)_([0-9a-z]+)$ results.asp?kwds=$1+$2 [NC,L]
RewriteRule ^([0-9a-z]+)_([0-9a-z]+)_([0-9a-z]+)$ results.asp?kwds=$1+$2+$3 [NC,L]

should fix it, too. Don't forget to clear the browser's cache.
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 18387701
Thanks for the 'A'.
Did it resolve your issue?
What was happening that was causing the confusion?
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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 …
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

919 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

12 Experts available now in Live!

Get 1:1 Help Now