I have the following .htaccess file that I use for a WP site:
# Force download of .csv files
AddType application/octet-stream .csv
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Which works fine, the first line just forces .csv
files to download and the rest redirects requests to the index.php
file, then I just tried to add some simple .htaccess
authentication by adding this at the top of the file:
AuthType Basic
AuthName "Protected Area"
AuthUserFile /.htpasswd
Require valid-user
The .htpasswd
file is in my root directory and it prompts me to enter the username and password I set, but if I type it correctly I get a 500 error page now, I’m not sure if it’s related to WP or if I’m doing something wrong in my .htaccess
file, I tried moving the code to the end of the file too but same results.
Can anyone help me? Thanks in advance!