Apache: Stealth 404 the admin area until authenticated via basic auth, then allow access
- by Kzqai
Given a administrative area with urls like this:
wp-admin/
wp-admin/whatever
wp-admin/another-page
wp-adminsecretlogin/
A standard basic-auth coverage would provide a username and password prompt on all three urls, and return a 403 on all failed auth attempts. This is a pretty obvious signal that something exists there, and thus is an invitation to script/brute force access.
I would like to instead, require basic auth everywhere, but when not authenticated, not prompt for username and password, and instead return a 404 not found error for all urls except a wp-adminsecretlogin/ url. At that individual-to-the-site url, basic auth could go through, and unlock the rest of the administrative functionality (though the standard application login would still be necessary).
How would I do that via apache .htaccess or .conf directives?