Google Answers Logo
View Question
Q: RewriteRule not working as expected ( Answered,   0 Comments )
Subject: RewriteRule not working as expected
Category: Computers > Software
Asked by: geoffreyf67_gman-ga
List Price: $40.00
Posted: 19 May 2006 15:17 PDT
Expires: 18 Jun 2006 15:17 PDT
Question ID: 730528
I've got several RewriteRules in my .htaccess file that I want to get processed.

When it comes across this line:

RewriteRule ^([0-9]+)/(.*).html$ /results.php?KEYWORDID=$1 [L]

It rewrites it into /results.php?KEYWORDID=1234

But it then continues processing the other lines in my htaccess file. 
As I understood it, the [L] should tell apache to stop rewriting at
this point.

The url is on the same server so I don't think [R] would apply here would it?

Some help would be greatly appreciated!

Subject: Re: RewriteRule not working as expected
Answered By: webadept-ga on 19 May 2006 16:41 PDT

I've always seen it used as [R,L], never just [L]. 

Remember: An unconditional external redirect to your own server will
not work with the prefix http://thishost because of this feature. To
achieve such a self-redirect, you have to use the R-flag

I'm guessing it is ignoring the [L] because it failed to do anything on that line. 

Try the [R, L] and if that doesn't work, post the version of Apache
you are using (shouldn't really matter, but sometimes little bugs are



Request for Answer Clarification by geoffreyf67_gman-ga on 21 May 2006 17:04 PDT
It's not redirecting to an external site thus the reason I left off
the R.  I'm using Apache 1.3.33 on debian linux.


Clarification of Answer by webadept-ga on 22 May 2006 13:34 PDT
Hi again, 

So you added the  [R, L] and it is still not working? 

There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy