.htaccess,URL中有一个“#”
我想在我的网站上把.htaccess,URL中有一个“#”,.htaccess,mod-rewrite,url-rewriting,urlencode,.htaccess,Mod Rewrite,Url Rewriting,Urlencode,我想在我的网站上把/tagged/c#映射到/?tagged=c#。显然,服务器看不到,因此我将其URL编码为%23。以下是我正在使用的.htaccess: RewriteBase / RewriteEngine On RewriteRule ^tagged/(.*)$ /?tagged=$1 [NC] 正如您所期望的,这是有效的,传递一个查询C#: 但这些都没有,都给出了C /tagged/C%23 /tagged/C%23moretextthatgetslost 我假设#被解释为一个文本
/tagged/c#
映射到/?tagged=c#
。显然,服务器看不到
,因此我将其URL编码为%23
。以下是我正在使用的.htaccess:
RewriteBase /
RewriteEngine On
RewriteRule ^tagged/(.*)$ /?tagged=$1 [NC]
正如您所期望的,这是有效的,传递一个查询C#
:
但这些都没有,都给出了C
/tagged/C%23
/tagged/C%23moretextthatgetslost
我假设#
被解释为一个文本散列,因此它会丢失在某个地方
我需要做些什么才能使第二个案例起作用?我需要使用标志: 对文件进行解释: 使用B标志,它将映射到
/C%2b%2b
到/index.php?show=/C%2b%2b
/tagged/C%23
/tagged/C%23moretextthatgetslost
RewriteBase /
RewriteEngine On
RewriteRule ^tagged/(.*)$ /?tagged=$1 [NC,B]