Tester
Tester

Reputation: 808

.htaccess RewriteRule with slash in url

What do I need to do to the following rewrite rule with slash in the url?

http://www.website.com/p/EQUITY+INVESTMENT+CORP%2FGA

to

http://www.website.com/test.php?name=EQUITY+INVESTMENT+CORP%2FGA

I tried the following way but not working.

RewriteRule ^p/(.*) /test.php?name=$1 [PT]

Upvotes: 2

Views: 55

Answers (1)

anubhava
anubhava

Reputation: 786289

Your rule is fine but %2F isn't allowed in URIs by Apache. To allow %2F to be encoded to / you need to add:

AllowEncodedSlashes On

in your <VirtualHost...> section or in global context of your Apache config.

Upvotes: 3

Related Questions