How to Restrict Access to your WordPress Site by IP or Logged In Users

Are you looking for a way to restrict visitors from accessing your website or want to redirect restricted users to a specific on your WordPress website? Perhaps you only want logged in users to see the site’s content. All this can be done easily with the help of a WordPress Plugin. You can also restrict access to your WordPress website for only specific IP addresses.

There are various method to restrict users from accessing your site. In this article, we will show you how to restrict page access control in WordPress by IP and logged in users using a WordPress Plugin. We will be using the Restricted Site Access Plugin to get the job done.

This plugin can come handy in situation where you want to test your newly developed WordPress website live on its domain and server. It can be also helpful in case you want to create a private site for your family, friends or co-workers.

Restricted Site Access Plugin

The Restricted Site Access Plugin is quite an adaptable plugin used to restrict access to a WordPress website for logged in users only or for users with specific IP Addresses. The Plugin is a great solution for Extranets and publicly hosted intranets. The plugin is also helpful for beta testing your WordPress website before it goes live for all the users on the Internet. Also, it is a great tool for creating a private website or blog for your family, friends, or co-workers.

With the Restricted site access plugin, you can also choose to redirect the restricted visitors. You can redirect restricted users to the login page, another web address, or display a custom message. You can even redirect them to a specific page that you have created on the same site. This is helpful when someone visits your site while you are still testing it. Restrict by IP feature is very useful if you want multiple employees in the office to have access to the development project without requiring them to register as a user.

Let’s learn to configure the Plugin on your WordPress website.

Configure Restricted Site Access Plugin

Step 1: Installing and Activating the Plugin

Log in to your WordPress dashboard and go to Plugins >> Add New. Search for Restricted Site Access plugin. Install and activate the plugin.

Step 2: Setting up the Plugin

Upon Activation, go to Settings >> Readings.

You will see that the plugin adds a new set of function for WordPress page access control. You will see a section for Site Visibility, Handle restricted visitors and Unrestricted IP addresses.

Upon activation, the Restricted page access is enabled by default.

You will see the following four options on how you want to handle the restricted users.

Send them to the WordPress login screen: With this option enabled, the unauthorized users will be redirected to the WordPress login Page.

Redirect them to a specified web address: With this option enabled, you can redirect unauthorized users to any specific URL. You can also assign a status code such as a 301, 302 or 307 redirect.

Show them a simple message: You can display custom web message to restricted users when this option is enabled.

Show them a page: This option is a bit different from all the above-mentioned features. By enabling this option, you can redirect your restricted your visitors to one of your site’s own pages rather than redirecting them to an external URL.

You also get the option to add Unrestricted IP Addresses. Click the “Add My Current IP Address” to give yourself unrestricted access to the site. Input the IP Address of the unrestricted users.

Note: We recommend you to enter a range of IP addresses for a specific user, unless the user pays for a static address. Doing so makes sure that the users have access to the site in case their IP is changed by their ISP. This can be done by including a “/” and highest number you wish to include. For example,

192.168.0.1/120

Now, click on “Save Changes” button to implement the changes.

Limitations

If you use any caching plugin on your WordPress website, then a warning screen will appear while installing the plugin. This is because the plugin is not compatible with some caching plugins as the restriction only affects the site and not the cached pages. If this is the case, then your cached content will be visible to the visitors. To avoid this, we recommend you clear your website cache after saving changes to the Restricted Site Access plugin. If the problem still persists, then you may have to choose another caching plugin for the Restricted Site Access plugin to work properly.

 Also, the plugin cannot be considered as a security plugin as it just handles unwanted visitors to your website. Your website is still prone to vulnerabilities if you don’t have a security plugin enabled.

Note: Developers can use the restricted_site_access_is_restricted filter to override normal restriction behavior. Note that restriction checks happen before WordPress executes any queries; it passes the query request from the global $wp variable so developers can investigate what the visitor is trying to load.

For example, to unblock an RSS feed, you can paste the following PHP code in the theme’s functions.php file:

  add_filter( 'restricted_site_access_is_restricted', 'my_rsa_feed_override’, 10, 2 );

    function my_rsa_feed_override( $is_restricted, $wp ) {
        // check query variables to see if this is the feed
        if ( ! empty( $wp->query_vars['feed'] ) ) {
            $is_restricted = false;
        }
        return $is_restricted;
    }

There are many other ways to restrict visitors from accessing your website. If you know any of them you can let us know in the comment section. Also, if you have any doubts regarding the article, you can leave a comment for that as well.

If you want us to cover a specific topic, please drop that into the comment section as well.

Recent Articles

How to Edit Footer in WordPress

As the name suggests, footer is the bottom most part (foot) of your website. It appears on all your webpages in most...

How to Install a Plugin in WordPress. Step by Step Guide for Beginners.

When we start using WordPress, one of the very first questions that comes to our mind is how to install plugins?

How to Create a WordPress Site Locally Using XAMPP

Do you want to learn to make websites using WordPress without actually installing it on a web hosting server?

Desktop Apps to add Instagram filters to your pictures

We live in an age where social media, where maintaining an Instagram grid is more important than anything. An aesthetic grid not...

Dating Apps for Seniors You can’t Miss out on in 2020

If you think online dating is only for youngsters then you are living in the wrong era. Online dating in the 21st...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here