Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

url redirect after the index.php? part

Status
Not open for further replies.

keak

Programmer
Sep 12, 2005
247
CA
Hi there,
I have a redirect rule
Code:
RewriteRule ^pic-template(\d*)-(\d*)/index.php?(.+)$ /gb/templates/prod/pic-template$1/index.php?color=$2&$3

All seems to work fine except the $3 part, which corresponds to the part index.php?(.+)

Is it possible to get this part of the URL (after the ? mark) with mod_rewrite in apache?
 
Hi

No, that is matched against the Request URI, so without the Query String part.

But you can add directly the QUERY_STRING instead of $3 :
Code:
RewriteRule ^pic-template(\d*)-(\d*)/index.php$ /gb/templates/prod/pic-template$1/index.php?color=$2&[red]%{QUERY_STRING}[/red]
If you need to extract only a part of the query string, then you have to use a [tt]RewriteCond[/tt] directive :
Code:
RewriteCond %{QUERY_STRING} [red](.*)[/red]
RewriteRule ^pic-template(\d*)-(\d*)/index.php$ /gb/templates/prod/pic-template$1/index.php?color=$2&[red]%1[/red]

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top