How to remove 403 forbidden in wordpress?

In this article we will teach you how to remove 403 forbidden in wordpress.

Cause of Error

  • This type of error arise when we move our website from one server to other server. Then there is a possibility of undefined root path for wordpress website and wordpress core directories wp-admin, wp-includes unavailable that time.
  • Second reason for error 403 forbidden in wordpress is due to missing .htaccess file in website root directory.
  • Third reason for error 403 forbidden in wordpress is due to wrong directory permissions. Your wordpress directories permissions should be 0755 and files permissions should be 0644.
  • Another reason for error 403 forbidden in wordpress is wrong URL of wordpress website.

How to solve error 403 forbidden in wordpress

Method 1 : Set Absolute Path to WordPress Directory

Under your wordpress root directory open the wp-config.php and paste the code given below.

/** Absolute path to the WordPress directory. */

if ( !defined('ABSPATH') )

define('ABSPATH', dirname(__FILE__) . '/');

define('CONCATENATE_SCRIPTS', false);

After adding this code open your website and your wordpress dashboard. And 403 error forbidden will gone.

Method 2 : Create .htaccess file in WordPress

Under your wordpress root directory create a .htaccess file and paste the code given below.

# BEGIN WordPress
<IfModule mod_rewrite.c>

RewriteOptions inherit
RewriteEngine on

Header set content-Security-Policy: upgrade-insecure-requests

RewriteBase /

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

After creating .htaccess file in wordpress your error 403 forbidden in wordpress will gone away.

Method 3 : Change Path and URL in WordPress Database

  • Download your wordpress database from phpmyadmin.
  • Keep backup of your wordpress database.
  • Then open your database file in text editor(Notepad, Notepad++, Sublime etc).
  • Find the word public_html and replace this word with the exact path of your wordpress website. For an example, you find the path home3/website_name/public_html and your website new path is home/website_name/public_html. Then replace home3/website_name/public_html with home/website_name/public_html.
  • Find the old url of your website in database file and replace with the new url of your wordpress website in database file. For an example your old website url was and your new website url is Then find with

After Changing in your database file, save your database file. Delete all the database tables in phpmyadmin and upload this updated database file in phpmyadmin. Finally the error 403 forbidden in wordpress will gone away.

Method 4 : Update WordPress Core Files

  • Download your latest wordpress from WordPress website.
  • Keep backup of your wordpress website files.
  • Open your file manager. Under your website root directory delete all files and directories except the wp-content directory. You do not need to delete the wp-content directory because it contains your website themes and plugins.
  • Now upload your new downloaded wordpress except the wp-content directory. You do not need to upload the wp-content directory.
  • Then under your website root directory open wp-config.php file. And enter your database credentials, your table prefix and enter the authentication unique keys and salts. You can also read this article WordPress curl error 60 SSL Certificate problem. See the sample code below or you can use this code of wp-config.php file.
define('DB_NAME', 'databasename');
/** MySQL database username */
define('DB_USER', 'databaseusername');
/** MySQL database password */
define('DB_PASSWORD', '7(tI5oB}AnC0');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
 * Authentication Unique Keys and Salts.
 * Change these to different unique phrases!
 * You can generate these using the {@link secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 * @since 2.6.0
define('AUTH_KEY',         ')(kZG>8+ 2i),`>^8mrs~IGph#;CO66t]6-p(&mb9ZvFDV]!Mf9M%RD[q*r|Bk~9');
define('SECURE_AUTH_KEY',  'X/@:>tzF{3TDezC`(/DB&f:]V684jR^ce}j8;dD:+%{Oc^mOeA~!B>77aBQ&#~_Q');
define('LOGGED_IN_KEY',    '66PKxbnI{M-YB8Uo,}X<rkPL4;jM[4>pl$4YTT%~{m>86zu3ndO6LNy<(?!Rf8[:');
define('NONCE_KEY',        'Yk !q$JdS4]C9 o]v{3b0c<;sBzfpJYI 06ZX`-4H, eILmCm8Y6N`+zBDU*}56e');
define('AUTH_SALT',        'h9}yVVDOjk]F:,4Kg]XA4!aW]6FPZy,74H72r{hQ0F}`+6#a#m?)5+3f7 ar}g(!');
define('SECURE_AUTH_SALT', 'LWDotl!zBnw3$wJg!k*LRs/$^L|,d}pVc-.ax_kB7p!}Q)BUx=Y{kEnE7t}5.Po,');
define('LOGGED_IN_SALT',   'C8YFR{>%P;$JjDe^V5L[9qcM}2pQ2_U&|;jFJpDZ$I}98y)P4M0w/|(Y^AlrDH1i');
define('NONCE_SALT',       'g[ B^k=Vtu~AkjgVAW+)$s^1nY2MzX8sQ>d0$LqC.(Cq~,K(mHo%0xLBlLh4w2]}');
 * WordPress Database Table prefix.
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
$table_prefix  = 'nhg856_';

Method 5 : Set Correct Directory and Files Permissions in WordPress

Inside your wordpress root directory all files should have permission 0644 and directory should have permissions 0755.

Method 6 : Update Permalinks in WordPress

Login to your wordpress dashboard and go to Settings -> Permalinks. Check the Post Name option in Common Settings and click on Save Changes.

After implementing one of methods given above please clear your browser cache and open your website again. Now the error 403 forbidden in wordpress will not show again.

If you want more tutorials and tricks about wordpress then visit our WordPress Page and follow us on FacebookTwitterTumblrLinkedin and if you like this article then share this.