Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-06-2011, 08:58 PM   PM User | #1
>ssp-cdr<
Regular Coder

 
Join Date: May 2007
Posts: 100
Thanks: 16
Thanked 11 Times in 11 Posts
>ssp-cdr< is an unknown quantity at this point
mod_rewrite regex help

Hi guys, I'm wondering if any of you can help me with a mod_rewrite regex.

I've devised a rule to handle specifying a userid value like: http://domain.com/directory/12345

Which is: RewriteRule ^([0-9]+)$ ?userid=$1 [L]

I want to adapt it so that if I need more parameters passed in I can do so using the regular ?var=1&loc=5 way.

Like this: http://domain.com/directory/12345?var=1&loc=5

I don't want to do something like this: http://domain.com/directory/12345/var/1/loc/5

I want to use the question mark and list the values in the standard URL way.

Thanks so much if you can help! :)
>ssp-cdr< is offline   Reply With Quote
Old 08-07-2011, 07:56 AM   PM User | #2
Cags
New Coder

 
Join Date: Jul 2011
Posts: 67
Thanks: 0
Thanked 13 Times in 13 Posts
Cags is an unknown quantity at this point
You want a query string from the original request to be persisted across to the rewritten address? If so you just need the QSA flag.

Code:
RewriteRule ^([0-9]+)$ ?userid=$1 [QSA,L]
Cags is offline   Reply With Quote
Users who have thanked Cags for this post:
>ssp-cdr< (08-07-2011)
Old 08-07-2011, 06:56 PM   PM User | #3
>ssp-cdr<
Regular Coder

 
Join Date: May 2007
Posts: 100
Thanks: 16
Thanked 11 Times in 11 Posts
>ssp-cdr< is an unknown quantity at this point
wow that did it! thanks so much
>ssp-cdr< is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
[IMG] code is On
HTML code is Off

Forum Jump


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


Advertisement
Log in to turn off these ads.