WordPress preventing you from password protecting a directory?

You wish to password protect a subdirectory using the cPanel icon (or a .htpasswd file), but you have WordPress installed in public_html with permalinks enabled. This causes your password protection to never work. The solution is simple.

  1. Login to your control panel's File Manager, or just connect to your domain with FTP.
  2. Edit the .htaccess file in your WordPress home folder (public_html) and remove the line shown in bold.
    Example:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
  3. Replace that line with this new line:
    RewriteRule ./ /index.php [L]
  4. The final code segment will 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

Now it's fixed.


آیا این پاسخ به شما کمک کرد؟

 پرینت این مقاله

در همین زمینه

Optimizing Wordpress

Wordpress is currently one of the most popular blogging/CMS applications. Here are some ideas...

WordPress HTTP Error or upload test error when uploading images

If you run across WordPress errors when you try to upload a file (typically an image), then...

WordPress error during the API request

Here is a fix for a WordPress error which we have seen. Error: *An Unexpected HTTP Error...

WordPress themes and templates

WordPress does allow you to download and use custom themes for your blog. You can find the...

404 Errors after clicking Wordpress links

This is a common issue when a blogs rewrite rules have been altered. You will notice this when...

Powered by WHMCompleteSolution