对于这种情况,设置.htaccess似乎很困难。对于约会网站,我们有这种情况:
We assume john is logged in:
domain.com/john //this works no problem
domain.com/?askout=yes&when=later //this doesn't work, if john is logged in and pastes
this url, it automatically redirects to domain.com/john
instead, htaccess should see the ? and know it's
not a valid user. It should keep the entire query,
and redirect to /profiles.php?askout=yes&when=later
这是.htaccess:
RewriteRule ^(\w+)/?$ ./profiles.php?username=$1
基本上,我需要知道.htaccess立即知道吗?意味着不使用上述重写规则。知道怎么做到这一点吗?
答案 0 :(得分:1)
尝试:
RewriteCond %{QUERY_STRING} askout=yes&when=later
RewriteRule ^ /profiles.php?askout=yes&when=later [L]
此规则需要在之前重定向到?username
目标的规则。
答案 1 :(得分:0)
我需要一个RewriteCond:http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html,您可以使用它进行各种检查