.htaccess 中的正则表达式错误,URL 中带有哈希标记

标签 regex .htaccess

这个正则表达式我做错了什么。

My requested url
http://domain.com/local/v11/full/#Q73Ps/

我在 .htaccess 中有什么

Options +FollowSymlinks
RewriteEngine On

RewriteRule ^local/v11/full/#([a-zA-Z0-9]+)/ local/v11/server/full.php?token=$1

上面的规则总是给我 404 错误。

添加日志

related apache error
[Thu Feb 09 14:04:21 2012] [error] [client 127.0.0.1] File does not exist: /path/to/folder/local/v11/full

related access logs
[09/Feb/2012:14:16:54 +0500] "GET /local/v11/full/ HTTP/1.1" 404 340

no re-write log

最佳答案

当您尝试访问:http://domain.com/local/v11/full/#Q73Ps/ 浏览器发送请求:http://domain.com/local/v11/full/ 并且不将 #Q73Ps/ 视为 URL 的一部分。如果你想让你的重写规则正常工作,请将 URL 中的 # 替换为 %23,它会起作用。

关于.htaccess 中的正则表达式错误,URL 中带有哈希标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9207938/

相关文章:

php - 在 PHP 中,如何在插入 MySQL 表之前转义字符串中的单引号?

apache - htaccess 重定向到 https ://www

php - htaccess 多个文件的 301 重定向

php - Htaccess Codeigniter问题

apache - htaccess 剥离 www 并强制使用 SSL

regex - 不要在 htaccess 中重定向子域

regex - url 中存在空格的 mod 重写问题

java - 使用正则表达式查找程序中 while 循环的数量

regex - 正则表达式中勉强的 '?' 有什么实际用途吗?

javascript - 匹配没有查询字符串的 Url 路径