.htaccess - How to stop processing if htaccess HTTP Auth fails -
i trying use http authentication in website root (public_html
) has rewritecond
, rewriterule
. when visit website, gives me prompt, when cancel, prompts me again, several times. finally, stops prompting , gives me home page html linked resources i.e. images, js, css etc. unavailable.
i have feeling http authentication failure did not cause htaccess script stop processing further, hence rewriterule still generated content. how can tell htaccess "stop processing further if auth failed"?
# manually added options +followsymlinks rewriteengine on # added cpanel password protect directory authuserfile "/home/username/.htpasswds/public_html/passwd" authtype basic authname "stage" require valid-user # manually added rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule . index.php [l]
i think need additional rewritecond
on rewrite, proceed if have valid user. example:
rewritecond %{la-u:remote_user} !^$ rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule . index.php [l]