Wordpress and password protected directories

When Wordpress is installed in the top level directory of a site and permalinks are enabled, existing password-protected subdirectories, or new subdirectories where password-protection is to be set, will not function properly due to the rewrite statements in the .htaccess file under the public_html. To resolve this, one of the directive lines in the .htaccess file must be edited. The .htaccess is a text file, and can be downloaded via FTP, edited, and then reuploaded, or edited in place via the File Manager option in the control panel, using the embedded edit function.

A typical wordpress .htaccess file with permalinks enabled looks like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

The bolded line in the sample above is the line to be edited. Change that line to this:

RewriteRule?./?/index.php?[L]

The new .htaccess file will then look like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./ /index.php [L]
</IfModule>
# END WordPress


If editing the file via the FTP download method, save the file and reupload it to the public_html of the site. if editing the file via the file manager, save the file.

When the new .htaccess is in place, log in to the administrative dashboard for your wordpress install, and choose Settings -> Permalinks. Resave your permalink structure.

Any existing password-protected directories will function again, and new password-protected can be created as needed.

  • 0 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

Vezani članci

PHP script error: FATAL ERROR: register_globals is disabled in php.ini, please enable it!

<b>Symptom: </b>The following error appears on a site running a php-based...

HOW TO: Combat referer spam/block certain referers

Symptom: A client wishes to deny access to their site (or parts of it) when the traffic is...

Expression Engine installation generates "variable references" error

Symptom: Expression Engine installations older than version 1.3.1 generate an "Only variable...

My phpBB forum installation is not accessible

Symptom: Client cannot access phpBB forum installation. Permissions on the forum installation...

Enabling register_globals

Symptom: A client's script requires that register_globals be enabled.Resolution: Globals are not...