在 PHP 的 HTaccess 参数中包含问号后的读取值



我正在使用.htaccess文件进行url重写。我的 .htaccess 文件包含

RewriteEngine On
RewriteRule ^([0-9a-zA-Z_-]+)$ edit_tutorial.php?tutorial_title=$1 [NC,L]

所以我的网址看起来像: www.xxxx.com/tutorials/abc-fdfg S11wagfgdrm bedf-dats fd? Not:so fast .

"abc-fdfg S11wagfgdrm bedf-dats fd? Not:so fast"是我的教程标题,其中包含冒号,问号,连字符,数字。我想为它编写重写规则。我也想要特殊字符。我怎样才能为它编写规则。请帮忙。

当我尝试使用$_REQUEST['tutorial_title']阅读标题时,我遇到了一个问题,我得到了这样的值:abc-fdfg S11wagfgdrm bedf-dats fd.我无法读取标记后?值。请帮忙。

您可以将

此规则用于从THE_REQUEST捕获QUERY_STRING

RewriteEngine On
RewriteCond %{THE_REQUEST} /tutorials/[^/?]+/?(?S*)?sHTTP
RewriteRule ^tutorials/([^/]+)/?$ user.php?tutorial_title=$1%1 [NC,L]

最新更新