Using a question mark in the rewrite
2 posts
• Page 1 of 1
Using a question mark in the rewrite
I am trying to create a rewrite rule as follows:
RewriteRule ^?ap-t-c-a-(\d+)-b-(\d+)$ /pages/pw.asp?A=$1&B=$2&Task=Click [NC,L]
So basically when someone visits my site and hits the page:
http://www.mysite.com/?ap-t-c-a-1-b-3
Its the same thing as going to http://www.mysite.com/pages/pw.asp?A=1&B=3&Task=Click
However when I try to run this rule I get an error as follows:
Unknown expression on line #78: RewriteRule ^?ap-t-c-a-(\d+)-b-(\d+)$ /pages/pw.asp?A=$1&B=$2&Task=Click [NC,L]
So I figure this has to do with the question mark.
Any help in allowing me to make this work would be very much appreciated.
Thanks
RewriteRule ^?ap-t-c-a-(\d+)-b-(\d+)$ /pages/pw.asp?A=$1&B=$2&Task=Click [NC,L]
So basically when someone visits my site and hits the page:
http://www.mysite.com/?ap-t-c-a-1-b-3
Its the same thing as going to http://www.mysite.com/pages/pw.asp?A=1&B=3&Task=Click
However when I try to run this rule I get an error as follows:
Unknown expression on line #78: RewriteRule ^?ap-t-c-a-(\d+)-b-(\d+)$ /pages/pw.asp?A=$1&B=$2&Task=Click [NC,L]
So I figure this has to do with the question mark.
Any help in allowing me to make this work would be very much appreciated.
Thanks
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Using a question mark in the rewrite
Hello,
Practically, everything after '?' is querystring. So you need the following syntax:
Regards
Andrew
Practically, everything after '?' is querystring. So you need the following syntax:
- Code: Select all
RewriteCond %{QUERY_STRING} ^ap-t-c-a-(\d+)-b-(\d+)$ [NC]
RewriteRule ^/?$ /pages/pw.asp?A=%1&B=%2&Task=Click? [NC,L]
Regards
Andrew
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 21 guests