{"id":25202,"date":"2018-01-25T02:38:16","date_gmt":"2018-01-25T08:38:16","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=25202"},"modified":"2022-12-05T06:39:49","modified_gmt":"2022-12-05T12:39:49","slug":"how-to-limit-dashboard-access-in-wordpress","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-limit-dashboard-access-in-wordpress\/","title":{"rendered":"How to Limit Dashboard Access in WordPress"},"content":{"rendered":"
<\/p>\n
In today’s tutorial, we’ll show you, How to Limit Dashboard Access in WordPress. WordPress is the most popular CMS in the world and is used to power over 60% of all websites using a CMS. With WordPress being so popular, WordPress sites are the most popular target for hackers who want to exploit the WordPress security vulnerabilities. To minimize the chances of your WordPress site being hacked, you should restrict access to the WordPress admin dashboard area and update the WordPress core, plugins and themes as soon as updates are available. Limiting the access to the WordPress admin area will help you to mitigate many common security threats. In this blog post, we will show you how to limit your WordPress site and to restrict access to the WordPress admin area, using the <\/p>\n If you are using Apache as your web server and you have a static IP address assigned to your machine then the easiest way to restrict access to the WordPress admin area to a specific IP address is to use the The rule above will show a 403 Forbidden message to anyone trying to access the WordPress admin area and WordPress login page except to the allowed IP address If you are using nginx as your web server then instead of editing Same as before, the rule above will show A 403 Forbidden message to anyone trying to access the WordPress admin area and WordPress login page except to the allowed IP address If you have a dynamic IP address, is not recommended to restrict access to the WordPress admin area to a single IP address because your IP address will change when you restart your router and you will not be able to access the WordPress admin area.<\/p>\n.htaccess<\/code> file if you are using Apache as you web server, or with nginx location rule if you are using Nginx as your web server.<\/p>\n
Limiting access to the WordPress dashboard area with .htaccess file<\/h2>\n
.htaccess<\/code> file. The
.htaccess<\/code> file is a hidden text file which resides in the WordPress root directory, usually named
public_html<\/code>. For example if your IP address is
123.123.123.123<\/code> to allow access to the WordPress admin area and to the WordPress login page only to your IP address, open the
.htaccess<\/code> file and add the following:<\/p>\n
RewriteEngine on\r\nRewriteCond %{REQUEST_URI} ^(.*)?wp-admin$ [OR]\r\nRewriteCond %{REQUEST_URI} ^(.*)?wp-login\\.php(.*)$ \r\nRewriteCond %{REMOTE_ADDR} !^123.123.123.123$\r\nRewriteRule ^(.*)$ - [R=403,L]\r\n<\/code><\/pre>\n
123.123.123.123<\/code>.<\/p>\n
Limiting access to the WordPress dashboard\u00a0 area with nginx rule<\/h2>\n
.htaccess<\/code> file you need to add the following location rule to your domain Nginx server block:<\/p>\n
location ~ ^\/(wp-admin|wp-login\\.php) {\r\n allow 123.123.123.123;\r\n deny all;\r\n}\r\n<\/code><\/pre>\n
123.123.123.123<\/code>.<\/p>\n
\n