WordPress.org

Ready to get started?Download WordPress

Forums

Allowing only certain IP addresses to view WordPress (6 posts)

  1. LJK
    Member
    Posted 6 years ago #

    Hi,

    I have created an intranet using WordPress running locally on MAMP, and the original idea was that it would be accessed by other computers on a network.

    However, we have now decided to put the site online, as it wouldn't rely upon the host machine being on all the time (basically acting like a server.)

    So, the question is- is there any way I can exclude all IP addresses, except those I specify, from accessing the site online?

    I know there are a lot of plugins for blocking individual IPs, but I really want to do the reverse!

    Thanks

  2. deuced
    Member
    Posted 6 years ago #

    An easy way is get WP-BAN and use wildcards to block access to everybody EXCLUDING your IP/Network or modify .htaccess

  3. LJK
    Member
    Posted 6 years ago #

    Thanks deuced, I'll have a go at that

  4. LJK
    Member
    Posted 6 years ago #

    Hi deuced, I installed WP-BAN and I'm not sure how I'd use wildcards to block access to everybody.

    Would this be using ranges? If so, do you know what syntax I should use?

    I'm a just a bit worried about doing it wrong and blocking myself out!

    I did also look at the .htaccess options, but seemed to make a server error when I tried to deny all and allow only the network IP.

    Thanks

  5. Kalessin
    Member
    Posted 6 years ago #

    I once had to do this same thing, but on a webserver on the company's premises.

    The .htaccess file reads as follows:

    order deny,allow
    deny from all
    allow from 192.168.1.

    This effectively blocked all calls to the folder containing the .htaccess and any subfolders, except from machines with internal IP addresses.

    Whilst creating this .htaccess file, I experienced server misconfiguration errors, which turned out to be caused by incorrect line endings (Dreamweaver was set to use Windows line-endings, rather than UNIX-style).

  6. deuced
    Member
    Posted 6 years ago #

    Kalessin is right, you could make a simple .htaccess file (with a notepad) and put it in your root, thats the simplest way for you.
    But in anyway you have to know the IPs (or range) of the machines u want to allow.

    I'm also wondering why don't you ask a server administrator since this machine is important for you and since you decide to give it a public IP.

    Anyway if you find easier WP-Ban instead of creating an .htaccess file, FIRST write in the Banned Exclude IPs YOUR IPs (no wildcards here) that you do wish to allow. Suppose u wanna allow 5 IPs then start putting them each in a row like that:

    192.168.1.35
    212.150.201.51
    ...

    After you have filled the Banned Exclude IPs (including there yours too!) then go to the upper window named Banned IPs which accepts wildcards and try anything u want. Since u have already EXCLUDE the IPs u want to allow there should be no problem.

Topic Closed

This topic has been closed to new replies.

About this Topic