I need to password protect on specific URL, for instance anyone can access index.php but as soon as they add parameters or “GET” variables I must require valid-user.
index.php -> sweet
index.php?prev=1 -> require valid user
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Interesting question.
Here’s a solution:
This part:
is there to prevent a direct access to /fakeindex.php (but in fact who would like to enforce a direct access to a protected zone). It’s optionnal.
The key point is that theses condition Rules detect a non empty Query string, and a request to index.php:
And that if they match the Rule:
Redirect internally the request to /fakeindex.php, keeping the query string with QSA. After that the Location is applied, and authentification is on the Location.