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

时间:2012-02-09 09:05:52

标签: 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

1 个答案:

答案 0 :(得分:6)

当您尝试访问:http://domain.com/local/v11/full/#Q73Ps/浏览器发送请求时:http://domain.com/local/v11/full/并且不会将#Q73Ps/视为网址的一部分。如果您想让重写规则正常工作,请使用#替换网址中的%23,这样就可以了。