[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: [OT] Re: modifying the query string & uri without a redirect ?
From:       Jonathan Vanasco <modperl-list () 2xlp ! com>
Date:       2005-12-24 18:33:09
Message-ID: F22E60ED-A804-4470-AC32-A2E341F812D5 () 2xlp ! com
[Download RAW message or body]

	(OT)

Ah.  Very odd.

I misinterpreted the NS flag

I had:
	RewriteRule ^/users/([\d]{1,9})$ /users/?id=$1 [QSA,L]

Now I have
	RewriteRule ^/users/([\d]{1,9})(/)?$ /users/?id=$1 [QSA,NS,L]

And it all works fine.

I realized that I wasn't seeing an actual redirect, but the query  
string was appeneded into the browser location.
With the NS, flag, the query string will not show.   I'm not sure why  
that happens or how.  Maybe its in part because I'm running this on  
localhost.

festive festivus,
Jonathan




On Dec 24, 2005, at 9:10 AM, John ORourke wrote:

> I'll give you the mod_rewrite solution but a mod_perl handler  
> version is similarly simple.
>
> RewriteRule /user/(.+)(/profile)? /user/profile?id=$1 [NS]
>
> This creates an internal subrequest (ie. users don't see it) for  
> the new URI, and if I remember rightly mod_rewrite will sort out  
> your query string for you.  If you have collisions with the 'id'  
> parameter I'd suggest changing your program logic - HTTP doesn't  
> strongly define parameter ordering or precedence so you might get  
> unexpected results!
>
> mod_rewrite only does an external redirect (so users see it) if the  
> destination URI is absolute (http://...) or if you add the 'R' flag  
> (like this:  "..... ?id=$1 [R,NS]" )
>
> $preferred_term_of_merriment  $choice_of_religious_holiday,
> John

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic