.htaccess: clean URLs and still protect a folder
Are you using clean URLs (like in WordPress) and do you also want to protect a folder with a password? Then the rewrite rule must leave the login page (code 401) alone. Otherwise you won't see the login prompt.
Put this in the .htaccess file in the public_html folder:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(401\.shtml)
RewriteRule ^(.*)$ index.php [L,QSA]
Everything that doesn't exist goes to index.php, except 401.shtml.
See also in the DirectAdmin guide: Password protected directories.
Detailed explanation with screenshots: Showing and editing hidden files such as .htaccess in the DirectAdmin guide.
