开发者

.htaccess: Unable to catch rule using RewriteCond

开发者 https://www.devze.com 2023-02-19 02:09 出处:网络
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%22

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%22ex开发者_Python百科pires%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!


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.

RewriteRule ^some-text-here-(\w+)-(\w+).html    /index.php?c=$1&m=$2 [QSA,L]


OK I've figured it out. The 1st line should be:

RewriteCond %{QUERY_STRING} session=(.*) 
0

精彩评论

暂无评论...
验证码 换一张
取 消