I have a Wordpress site which contains a link to a non-WordPress (i.e. pure Html) page sitting on a subdirectory of the same domain. It all works fine at the moment but now I wish to password protect that subdirectory.
I tried adding .htaccess and .htpasswd files but then when I attempt to go to that page, instead of seeing the expected "please type a username and password" I see "This page doesn't seem to exist."
I know there are ways of adding passwords from one WordPress page to another but this issue is from WordPress to non-WordPress.
EDIT: As requested... the root directory contains the following four subdirectories:
- wp-content
- wp-includes
- wp-admin
- info
There is a link on the front page of the wordpress site like so:
Take a look at the results <a href="http://www.example.com/info/results.htm">here</a>
I put both the .htaccess and .htpasswd files in the "info" directory. The info directory also contains "results.htm" of course.
The \info\.htaccess file contains:
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /home2/public_html/example/info/.htpasswd
Require valid-user
Options -Indexes
the root .htaccess contains:
# 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
If I temporarily disable the root .htaccess file by renaming it then the whole thing works. I.e. I do see the request for username and password when I try and access the /info/results.htm file.
.htaccess
files..htaccess
file? Does this contain just the standard WP code block (ie. front-controller)? If you temporarily rename the root.htaccess
file (essentially disabling WP) are you presented with the username/password dialog?/home2/public_html/example/info/.htpasswd
" - To clarify... your document root is/home2/public_html/example
and not/home2/public_html
(as one might expect)?.htaccess
files along the file system path? eg. No.htaccess
file directly in thepublic_html
directory (which would still apply here)?