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
  • 356,200
  • 43
  • 426
  • 500
15412s
  • 3,298
  • 5
  • 28
  • 38

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
  • 761,203
  • 64
  • 569
  • 643
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