1

我正在尝试使用特殊字符,URLs但在理解我应该做些什么以使其正常工作时遇到了一些麻烦。

我见过这样的网址:

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

在 Last.FM 上完美运行,但我该怎么做呢?

我已经在这个问题上提出了一些方法,但部分解决了我的问题,这要归功于.htacessfile中的正则表达式帖子(.+?),但我在阅读 url 时仍然遇到问题。

如果我写类似的东西http://mysite.com/event/Dance&Jump并在我的 php 页面中使用:

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

<?
    print urldecode ($_REQUEST["event_name"]);
?>

该页面将打印:

//<html> printed page

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

//</html> printed page

我希望能够使用几乎所有特殊字符,例如 Last.FM 或 Wikipedia

使用特殊字符 url 和常用程序的技术如何?

4

1 回答 1

1

尝试B标志

RewriteRule ^event/(.+?)/?$ event.php?event_name=$1 [B]
于 2010-01-30T17:32:31.343 回答