0

I'm working with apache mod_rewrite that suppots perl regex. How can I use question mark as a normal char? for example:

RewriteCond %{REQUEST_URI} ^(/.*/service/City?name)=(.*)-(.*)$
Marc B
  • 348,685
  • 41
  • 398
  • 480
15412s
  • 2,888
  • 4
  • 25
  • 36

2 Answers2

2

You don't match query string using RewriteCond %{REQUEST_URI}. You will need to use QUERY_STRING variable for that. So correct way will be this:

RewriteCond %{QUERY_STRING} ^name=(.*)-(.*)$
RewriteCond %{REQUEST_URI} ^(/.*/service/City)$
anubhava
  • 713,503
  • 59
  • 514
  • 593
1

you can also have a look here :

Match Question Mark in mod_rewrite rule regex

since you are working with mod_rewrite you might want to hide your ? completely. The post above will explain how to do that.

Community
  • 1
  • 1
Aionicus
  • 41
  • 2