Forum Moderators: phranque
Need your help in reducting URL's with a query string to home page. I have bunch of URL's like this
http://www.example.com/dev/?id=1
http://www.example.com/dev/?id=2
and so on ...
and
http://www.example.com/test/?id=1
http://www.example.com/test/?id=2
and so on ...
I would like to redirect all those URL's to http://www.example.com
Can someone help/guide me please.
Thanks
Chris
Do you want to redirect *all* URLS with the "id=number" query string appended to "www.example.com/", or only those in the /dev and /test subdirectories?
And how about that id number -- Is it always a single digit, or might it be two or more? If so, do you want to redirect based on the number of digits, or redirect no matter how many digits are present?
It's best to be extremely specific before getting into any discussion of coding, because regular-expressions pattern-matching requires precision: Incomplete or bad requirements specification => bad code.
Jim
Thanks for your quick response.
Do you want to redirect *all* URLS with the "id=number" query string appended to "www.example.com/", or only those in the /dev and /test subdirectories?
>> Only the /dev/ and /test/ subdirectories
And how about that id number -- Is it always a single digit, or might it be two or more? If so, do you want to redirect based on the number of digits, or redirect no matter how many digits are present?
>> redirect no matter how many digits are present
Thank you,
Chris
Referring to the resources cited in our Apache Forum Charter, try putting together a rule with that info, and be sure to post any questions back here.
You'll need to replace the broken pipe "Š" character in the RewriteRule pattern above with a solid pipe before trying to use it; Posting on this forum modifies the pipe characters.
Jim