0

Setting up an .htaccess seems to be difficult for this situation. For a dating site we have this scenario:

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

Here is the .htaccess:

RewriteRule ^(\w+)/?$ ./profiles.php?username=$1

Basically, I need to have .htaccess know that an immediate ? means not to use the above rewrite rule. Any idea how to accomplish this?

2 Answers 2

1

Try:

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

This rule needs to go before the rule you have redirecting to the ?username target.

Sign up to request clarification or add additional context in comments.

Comments

0

You need a RewriteCond I think: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html, with which you can do all manner of checks

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.