URL rewrite help with Querystring needed

Discuss practical ways rearrange URLs using mod_rewrite.

URL rewrite help with Querystring needed

Postby mamin123 » Thu Sep 18, 2008 6:13 pm

I have below rule written which works fine with one scenario:

Code: Select all
RewriteRule ^.+-p-(.+)\.htm?$ /showproduct.asp?productid=$1


Will covert to below as expected


but I have second scenario where i want to covert below url to as follows"


How do I achieve both scenario with one rule if possible.

If not possible, what will be second rule I need ?

Thanks in advance for your help
Posts: 2
Joined: Mon Sep 01, 2008 11:05 am
Location: USA

Postby richardk » Fri Sep 19, 2008 7:28 am

With the QSA (Query String Append) flag.
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^.+-p-(.+)\.htm$ /showproduct.asp?productid=$1 [QSA,L]
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 6 guests