0

对于这种情况,设置 .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 立即知道?表示不使用上述重写规则。知道如何做到这一点吗?

4

2 回答 2

1

尝试:

RewriteCond %{QUERY_STRING} askout=yes&when=later
RewriteRule ^ /profiles.php?askout=yes&when=later [L]

此规则需要在您重定向到目标的规则之前。?username

于 2012-10-17T22:25:00.193 回答
0

我认为您需要一个 RewriteCond:http ://httpd.apache.org/docs/2.2/mod/mod_rewrite.html ,您可以使用它进行各种检查

于 2012-10-17T22:17:25.500 回答