# 标签不在 htaccess 文件中重写
# tag Not rewrite in htaccess file
我遇到了 .htaccess 文件中的 # 标签问题。
问题是
http://localhost/query/index.php?string=abc%23123
这里我们使用urlencode()
方法对查询字符串进行编码。
实际值为
abc#123
但它在 $_REQUEST[]
方法上造成了问题..
所以有人建议我使用 urlencode()
。
采纳了建议,我用了。但现在它在
url重写。
.htaccess 代码是
RewriteRule ^([A-Za-z0-9-]+).html?$ index.php?string= [NC,L]
现在,当我单击查询字符串页面时
显示 404
未找到
http://localhost/query/abc%23123.html
所以请帮助我使页面在浏览器上显示为
所以请建议我将在我的 .htaccess 文件中更改哪些内容 url 对我有用
您可以将此规则与 B
标志一起使用:
RewriteRule ^([^.]+)\.html?$ index.php?string= [NC,L,QSA,B]
这会将 http://localhost/query/abc%23123.html
未编码传递给 index.php
。在 index.php
中,当您使用 $_GET['string']
时,它将打印:
query/abc#123
我遇到了 .htaccess 文件中的 # 标签问题。 问题是
http://localhost/query/index.php?string=abc%23123
这里我们使用urlencode()
方法对查询字符串进行编码。
实际值为
abc#123
但它在 $_REQUEST[]
方法上造成了问题..
所以有人建议我使用 urlencode()
。
采纳了建议,我用了。但现在它在 url重写。
.htaccess 代码是
RewriteRule ^([A-Za-z0-9-]+).html?$ index.php?string= [NC,L]
现在,当我单击查询字符串页面时
显示 404
未找到
http://localhost/query/abc%23123.html
所以请帮助我使页面在浏览器上显示为
所以请建议我将在我的 .htaccess 文件中更改哪些内容 url 对我有用
您可以将此规则与 B
标志一起使用:
RewriteRule ^([^.]+)\.html?$ index.php?string= [NC,L,QSA,B]
这会将 http://localhost/query/abc%23123.html
未编码传递给 index.php
。在 index.php
中,当您使用 $_GET['string']
时,它将打印:
query/abc#123