views:

106

answers:

5

I am using htaccess. I try to pass a value in url like 'C++'.

like "http://domain.com/Details/c++/detail.html"

I am retrieving the value in htaccess like

RewriteRule ^Details/([a-zA-Z_0-9_.,'&/-]+)/(([a-zA-Z_0-9_.,'&/-]+).html)$ index.php?page=$2&id=$1

But it returns only 'c'. Symbol '+' not accepted. I need the the value 'c++'.

Is there any solution?

+3  A: 

Try Url encoding the + character.

"http://domain.com/Details/c%25%25/detail.html"

g .
The problem is, that in a URL the `+` is the encoding for a space. You can circumvent this with g.'s method.
Boldewyn
did I need to do this in .htaccess file?
RSK
`%20` is the encoding for a space.
random
+1  A: 

Is it possible to escape it, like http://domain.com/Details/c%25%25/detail.html. (I'm only guessing)

Johannes Hoff
+1  A: 

http://domain.com/Details/c%2B%2B/detail.html

J-16 SDiZ
+1  A: 

A small consolation is: you are not alone. Since this problem is by design in URIs, eben big sites like Google have their problems with it:

http://www.google.com/search?q=c++

This does a search for just “c”.

Konrad Rudolph
+1  A: 

Try it with the B flag:

RewriteRule ^Details/([a-zA-Z0-9_.,'&/-]+)/([a-zA-Z0-9_.,'&/-]+\.html)$ index.php?page=$2&id=$1 [B]
Gumbo