Password Protecting a WordPress installed in a directory of a WordPress install?
-
Hi everyone,
So I’m working on a draft of a WordPress site in a live environment. I want to password protect it. This draft is at myurl.com/test/wordpress2/ and myurl.com has WordPress installed on it as well. I’ve looked up a zillion articles about .htaccess and WordPress but none of them seem to deal with having a WordPress below a WordPress.
I’ve tried a number of configurations that variously end in either a 500 error or a 404 error.
Here’s what I have as .htaccess at myurl.com/
ErrorDocument 401 /MYURL.COM/onerror.html ErrorDocument 403 /MYURL.COM/onerror.html <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/(failed_auth\.html).*$ [NC] RewriteRule . - [L] </IfModule> # 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
And here’s what I have at myurl.com/test/
ErrorDocument 401 /MYURL.COM/test/onerror.html ErrorDocument 403 /MYURL.COM/test/onerror.html <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/(failed_auth\.html).*$ [NC] RewriteRule . - [L] </IfModule> # 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 AuthType Basic AuthUserFile /MYURL.COM/test/.htpasswd AuthName “Password protected area” require valid-user The .htpasswd file is at myurl.com/test/.htpasswd
Can anyone help me figure out why this is producing a 404? I have no idea. The guides I’ve looked up for fixing this problem led me to the ErrorMessage 401 / 403 lines, but I suspect it’s something about the order and number of my .htaccess files.
- The topic ‘Password Protecting a WordPress installed in a directory of a WordPress install?’ is closed to new replies.