I would like to have pretty URLs for my tagging system along with all the special characters: +
, &
, #
, %
, and =
. Is there a way to do this with mod_rewrite without having to double encode the links?
I notice that delicious.com and stackoverflow seem to be able to handle singly encoded special characters. What's the magic formula?
Here's an example of what I want to happen:
http://www.example.com/tag/c%2b%2b
Would trigger the following RewriteRule:
RewriteRule ^tag/(.*) script.php?tag=$1
and the value of tag would be "c++"
The normal operation of apache/mod_rewrite doesn't work like this, as it seems to turn the plus signs into spaces. If I double encode the plus sign to '%252B' then I get the desired result - however it makes for messy URLS and seems pretty hack to me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…