开发者

Using an url with & char and the rest of special chars

开发者 https://www.devze.com 2022-12-19 03:35 出处:网络
I\'m trying to work with special chars in URLs but I have some trouble on undertand what I shuld do to get it works correctly.

I'm trying to work with special chars in URLs but I have some trouble on undertand what I shuld do to get it works correctly.

I've saw URLs like:

http://www.last.fm/music/Simon+&+Garfunkel
http://www.last.fm/music/小林武史

works perfectly on Last.FM, but how can I do that?

I've asked at this question some way to do it, but has solved my problem partially thanks the regex post in .htacess file (.+?), but I still have problems on read the url.

If i write something like http://mysite.com/event/Dance&Jump and use in my php page:

//.htaccess
RewriteEngine On
RewriteRule ^(event/)(.+?)[/]?$ event.php?event_name=$2

<?
    prin开发者_Go百科t urldecode ($_REQUEST["event_name"]);
?>

the page will print:

//<html> printed page

    Dance // "&Jump" is missing, how can I fix it?

//</html> printed page

I'd like to be able to work with almost all special chars like Last.FM or Wikipedia

How are the tecniques to work with special char url and the common procedures?


Try the B flag:

RewriteRule ^event/(.+?)/?$ event.php?event_name=$1 [B]
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号