URLRewrite problem (seems it continues rewriting in spite of [L])

This is a discussion on URLRewrite problem (seems it continues rewriting in spite of [L]) within the Apache Web Server forums, part of the Web Server and Related Forums category; It seems very simple, but I'm already about knocking my head against walls. I want urls like "http://...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-06-2006
rr
 
Posts: n/a
Default URLRewrite problem (seems it continues rewriting in spite of [L])

It seems very simple, but I'm already about knocking my head against
walls.

I want urls like "http://host/dir/blabla" to be rewritten to
"http://host/dir/script.php?param=blabla"

The following .htaccess is put into /dir/

---- .htaccess ---
RewriteEngine On
RewriteRule ^(.*)$ script.php?param=$1 [L]
-----------------------

The script.php ( in /dir/) gets "param" as "script.php".

If I use something like
RewriteRule ^([^s].*)$ script.php?param=$1 [L]
the engine works as I want.

So, what's up?

Thank you!

  #2 (permalink)  
Old 12-06-2006
HansH
 
Posts: n/a
Default Re: URLRewrite problem (seems it continues rewriting in spite of [L])

"rr" <anatoly.rr@gmail.com> schreef in bericht
news:1165424677.534833.121310@80g2000cwy.googlegro ups.com...
> I want urls like "http://host/dir/blabla" to be rewritten to
> "http://host/dir/script.php?param=blabla"
>
> The following .htaccess is put into /dir/
> RewriteEngine On
> RewriteRule ^(.*)$ script.php?param=$1 [L]
>
> The script.php ( in /dir/) gets "param" as "script.php".
>
> If I use something like
> RewriteRule ^([^s].*)$ script.php?param=$1 [L]
> the engine works as I want.
>
> So, what's up?

Your destination after rewrite is in the same folder, either
put it elsewhere or exclude it from the rewrite:
RewriteCond %{SCRIPT_URL} !/script\.php$
RewriteRule (.*) script.php?param=$1 [L]

HansH


  #3 (permalink)  
Old 12-07-2006
R Krause
 
Posts: n/a
Default Re: URLRewrite problem (seems it continues rewriting in spite of [L])

rr wrote:
> It seems very simple, but I'm already about knocking my head against
> walls.
>
> I want urls like "http://host/dir/blabla" to be rewritten to
> "http://host/dir/script.php?param=blabla"


An internal redirect is performed after a URL rewrite, which will
re-execute all of the rules in .htaccess causing infinite recursion. I
like to check if a status variable is set and be done. Also you don't
need the end-of-line anchor since regexps are greedy by default.

RewriteCond %{ENV:REDIRECT_ISDONE} =""
RewriteRule ^(.*) script.php?param=$1 [E=ISDONE:1,L]

--Randall

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:00 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0