You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Coughlin, Michael J" <Mi...@opm.gov> on 2013/02/08 22:19:23 UTC

[users@httpd] RewriteRule problem

The request:

www.mysite.com/testing123

The rule:

RewriteRule ^(testing.*)$ test.php?req=$1 [NC,L]

test.php properly renders the querystring "req=testing123" (its only purpose to verify the querystring)

BUT, 

RewriteRule ^(t.*)$ test.php?req=$1 [NC,L]

gives me:  "req=test.php".

I don't get it.  Why is $1 backreferenced as "test.php"?  In fact, any string before (testi.*) gives me test.php
, but anything after gives me the testing123.  Some strange lexical order thing going on?

Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] RewriteRule problem

Posted by "Coughlin, Michael J" <Mi...@opm.gov>.
What a disaster,  the htaccess rules run twice.  no wonder.

It's easy enough to catch on a second pass now that I know what's happening, but this little subtle point could be made a BIG point in the apache documentation for htaccess.

Thanks for the clue about the repass.

________________________________________
From: Boubouch [boubouch52@gmail.com]
Sent: Friday, February 08, 2013 4:54 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] RewriteRule problem

Sorry i mean

>> RewriteRule ^(t.*)$ test.php?req=$1 [NC,END]

The flags END are stronger than L and may be you loop from testing123 to test.php both matching

Le 8 févr. 2013 à 22:46, Boubouch <bo...@gmail.com> a écrit :

> Hi,
>
> Could you try this
>
>> RewriteRule ^(t.*)$ test.php?req=$1 [NC,END]
>
>
> Le 8 févr. 2013 à 22:19, "Coughlin, Michael J" <Mi...@opm.gov> a écrit :
>
>> The request:
>>
>> www.mysite.com/testing123
>>
>> The rule:
>>
>> RewriteRule ^(testing.*)$ test.php?req=$1 [NC,L]
>>
>> test.php properly renders the querystring "req=testing123" (its only purpose to verify the querystring)
>>
>> BUT,
>>
>> RewriteRule ^(t.*)$ test.php?req=$1 [NC,L]
>>
>> gives me:  "req=test.php".
>>
>> I don't get it.  Why is $1 backreferenced as "test.php"?  In fact, any string before (testi.*) gives me test.php
>> , but anything after gives me the testing123.  Some strange lexical order thing going on?
>>
>> Thanks
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] RewriteRule problem

Posted by Boubouch <bo...@gmail.com>.
Sorry i mean

>> RewriteRule ^(t.*)$ test.php?req=$1 [NC,END]

The flags END are stronger than L and may be you loop from testing123 to test.php both matching

Le 8 févr. 2013 à 22:46, Boubouch <bo...@gmail.com> a écrit :

> Hi,
> 
> Could you try this
> 
>> RewriteRule ^(t.*)$ test.php?req=$1 [NC,END]
> 
> 
> Le 8 févr. 2013 à 22:19, "Coughlin, Michael J" <Mi...@opm.gov> a écrit :
> 
>> The request:
>> 
>> www.mysite.com/testing123
>> 
>> The rule:
>> 
>> RewriteRule ^(testing.*)$ test.php?req=$1 [NC,L]
>> 
>> test.php properly renders the querystring "req=testing123" (its only purpose to verify the querystring)
>> 
>> BUT, 
>> 
>> RewriteRule ^(t.*)$ test.php?req=$1 [NC,L]
>> 
>> gives me:  "req=test.php".
>> 
>> I don't get it.  Why is $1 backreferenced as "test.php"?  In fact, any string before (testi.*) gives me test.php
>> , but anything after gives me the testing123.  Some strange lexical order thing going on?
>> 
>> Thanks
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] RewriteRule problem

Posted by "Coughlin, Michael J" <Mi...@opm.gov>.
END is not a valid flag.  That generates a server error.

________________________________________
From: Boubouch [boubouch52@gmail.com]
Sent: Friday, February 08, 2013 4:46 PM
To: users@httpd.apache.org
Cc: users@httpd.apache.org
Subject: Re: [users@httpd] RewriteRule problem

Hi,

Could you try this

> RewriteRule ^(testing.*)$ test.php?req=$1 [NC,END]


Le 8 févr. 2013 à 22:19, "Coughlin, Michael J" <Mi...@opm.gov> a écrit :

> The request:
>
> www.mysite.com/testing123
>
> The rule:
>
> RewriteRule ^(testing.*)$ test.php?req=$1 [NC,L]
>
> test.php properly renders the querystring "req=testing123" (its only purpose to verify the querystring)
>
> BUT,
>
> RewriteRule ^(t.*)$ test.php?req=$1 [NC,L]
>
> gives me:  "req=test.php".
>
> I don't get it.  Why is $1 backreferenced as "test.php"?  In fact, any string before (testi.*) gives me test.php
> , but anything after gives me the testing123.  Some strange lexical order thing going on?
>
> Thanks
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] RewriteRule problem

Posted by Boubouch <bo...@gmail.com>.
Hi,

Could you try this

> RewriteRule ^(testing.*)$ test.php?req=$1 [NC,END]


Le 8 févr. 2013 à 22:19, "Coughlin, Michael J" <Mi...@opm.gov> a écrit :

> The request:
> 
> www.mysite.com/testing123
> 
> The rule:
> 
> RewriteRule ^(testing.*)$ test.php?req=$1 [NC,L]
> 
> test.php properly renders the querystring "req=testing123" (its only purpose to verify the querystring)
> 
> BUT, 
> 
> RewriteRule ^(t.*)$ test.php?req=$1 [NC,L]
> 
> gives me:  "req=test.php".
> 
> I don't get it.  Why is $1 backreferenced as "test.php"?  In fact, any string before (testi.*) gives me test.php
> , but anything after gives me the testing123.  Some strange lexical order thing going on?
> 
> Thanks
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org