.htaccess:无法使用 RewriteCond 捕获规则
Facebook 返回以下结果:
http://www.mydomain.com/some-text-here-auth-login.html?session={%22session_key%22%3A%2295da8e65851d8ec74c381171-650901429%22%2C%22uid%22%3A%22650901429%22%2C%22expires%22%3A0%2C%22secret%22%3A%223chidden%22%2C%22base_domain%22%3A%22mydomain.com%22%2C%22access_token%22%3A%22171372936213670|95da8e65851d8ec74c381171-650901429|x_1y78ix4VU8Wr9qytDqV-DWBk0%22%2C%22sig%22%3A%22708bf3fd1703e4c368afe22fc70ed08c%22}
在我的 .htaccess 上有以下几行:
RewriteCond %{QUERY_STRING} session=\{(.*)\}
RewriteRule ^some-text-here-(\w+)-(\w+).html /index.php?c=$1&m=$2&session=%1 [L]
但它不符合规则。
能帮我这个笨蛋解答一下吗?谢谢!
Facebook returns the following result:
http://www.mydomain.com/some-text-here-auth-login.html?session={%22session_key%22%3A%2295da8e65851d8ec74c381171-650901429%22%2C%22uid%22%3A%22650901429%22%2C%22expires%22%3A0%2C%22secret%22%3A%223chidden%22%2C%22base_domain%22%3A%22mydomain.com%22%2C%22access_token%22%3A%22171372936213670|95da8e65851d8ec74c381171-650901429|x_1y78ix4VU8Wr9qytDqV-DWBk0%22%2C%22sig%22%3A%22708bf3fd1703e4c368afe22fc70ed08c%22}
On my .htaccess are the following lines:
RewriteCond %{QUERY_STRING} session=\{(.*)\}
RewriteRule ^some-text-here-(\w+)-(\w+).html /index.php?c=$1&m=$2&session=%1 [L]
But it's not falling into the rule.
Could you please help a dumber like me figure it out? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
比您的解决方案更好的主意是根本不手动触摸查询字符串,而是使用 QSA 将其附加到重写的 URL 中。
A better idea than your solution is not to touch the querystring manually at all and instead use QSA to append it to the rewritten URL.
好吧,我已经弄清楚了。第一行应该是:
OK I've figured it out. The 1st line should be: