Anurag Singh
Anurag Singh

Reputation: 727

unable to escape "?" in the url rewriting in htaccess

I have URL as: spa-shop/admin/index?docid=abc ,For this URL i am using htacces Rewrite Rule. The rule is as follow:

RewriteRule ^((?i)spa-shop)/(admin)/([a-zA-Z\?]*)$             spavendor/index.php?url=spaAdmin/$3 [L]

In this the output which i am expecting is : spashop/index.php?url=spaAdmin/index?docid=abc , but I am getting the URl as: spashop/index.php?url=spaAdminShop/index. Please let me know what is the problem though i am escaping the ? in the rewrite rule. But it seems not being escaped.

Upvotes: 2

Views: 104

Answers (2)

anubhava
anubhava

Reputation: 786021

You can replace your rule by this rule:

RewriteRule ^(spashop)/admin/([a-zA-Z]+)/?$ $1/index.php?url=spaAdminShop/$2\?%{QUERY_STRING} [L,NC]

Upvotes: 0

Identity1
Identity1

Reputation: 1165

You need to use

urlencode($someURl)

This will encode ? to %3F

Upvotes: 1

Related Questions