Get in touch with me Get a fresh perspective.

My New WordPress Plugin: Localhost Restricter

From January 21st, 2007 | 11 Comments

Once again, I created a WordPress plugin based on my own needs. This one allows you to test your website on your local server environment without worry that somebody is trying to access it from the outside.

It only allows ‘http://localhost’ and ‘http://127.0.0.1′ as the URL and will deny any attempt to use your server’s IP address (i.e. http://123.45.67.89). It prevents nosy people from seeing what your next website will look like before it’s ready! ;)

This is the first official WordPress plugin that I’ve made. It follows the WordPress plugin guidelines and can be activated easily on the plugin page.

To install:

  1. Unzip
  2. Upload to plugin directory (wp-content/plugins)
  3. Activate via the plugin interface in the admin panel

Donate

Do you like this plugin? I spend a lot of time developing these. Please consider donating so I can continue to update this and others.


Customizing: You can customize this plugin to do just about anything. You can redirect the visitor to another webpage, output an error message, or just leave it as it is and provide a blank page.

You can download it here:

Localhost Restricter Version 1.0

If there are any questions or comments, please reply to this topic in the comments below.

11 Responses

  • Date Heure
    January 22, 2007 at 12:27 pm

    Nice one! I normally do that in my apache config file when working on a website locally (I use EasyPHP to run apache, php and mySQL on Windows). This is a great idea though for wordpress-based websites.

  • Nate Olson
    January 22, 2007 at 2:19 pm

    Thanks for making this publicly available, Trevor. Sounds quite useful, and I’ll certainly give it a test as I’m in need of something like this just now.

    Cheers,

    Nate

  • dave
    January 28, 2007 at 5:04 am

    Excellent, I’ve done this manually before int he header php file but to have a customisable script as a plugin is great.

    Some I’d really like which I can’t work out how to do is to use such a script to block access from any client, but allow from my server.

    I use Joomla as my CMS but then I stumbled on WordPress (a while ago) so I opted for WP as my blog and Joomla for everything else, I run WP via the Joomla wrapper module (iframe)

    It would be great to block any attempting http://site.com/blog and allow any clicking on the wrapper link to go to the same URL.

    I can get it working with http_referrer fine, but then once loaded all WP links and menus are blocked because its client based.

    but anyway, thanks for the plugin.

    (ps, yes I’m complete newb learning as I go, so I probably don’t have the right understanding of the functions of http_server and http_referrer)

    cheers
    dave

  • February 20, 2007 at 11:32 am

    For a self-hosted blog server, it’d be safer & cleaner to stop it at network perimeter (a router, a firewall or a proxy server). To name a few, iptables on Linux and Windows Firewall on Windows, or other firewall of your choice, squid rules.

    Short of that, apache’s ‘deny from’ directive should works great too, in the main httpd.conf or local .htaccess.

    The plugin should be only be necessary when you are in a hosted environment when you don’t have control over the above layers of defense.

  • Trevor Fitzgerald
    February 20, 2007 at 4:27 pm

    Jerry,

    I agree and I actually do the same thing. I use an .htaccess file to deny access from anyone but myself.

    < Files "*" >
    order deny,allow
    deny from all
    allow from 127.0.0.1
    < /Files >

    ^ Works perfectly. (minus the spaces before and after the tags because I can’t post tags in the comments here).

    However, this plugin accomplishes pretty much the same thing. I suppose I could make it so that it restricts access based on IP address, too, and not just the URL.

    Thanks,
    Trevor

  • March 24, 2007 at 2:09 pm

    Or simply block outside access using XAMPP.

  • Gary Olson
    May 31, 2008 at 10:16 am

    Great Job Here…I enjoyed it..! Gary

  • David Leon
    August 23, 2008 at 3:45 am

    Thank you so much. Check out my blog, it is already there… You might not understand much, since it is in Uk

  • Ottawa Escort
    September 17, 2008 at 1:44 pm

    Very Good!!
    I Like!!

  • Crane Machine
    September 21, 2008 at 9:48 am

    Very Good~!!

  • Baran
    November 15, 2008 at 2:04 pm

    Very Good!!

Leave a Reply

Are you on Twitter? You can also comment via Twitter by clicking here.

Please enter your name, e-mail address, and comment. Thank you!
Twitter

Twitter Updates

  •  

You should follow me on Twitter here.

RSS

From The Blog

03Mar

Introducing Earthly WordPress Theme

Based on my first WordPress theme, Crispp, Earthly incorporates a color scheme designed for sites that require an eco-friendly or earthy theme. Features 100% Free Consistent styling across all major …

Continue Reading…

28Dec

YouTube Resizer jQuery Plugin

The jQuery YouTube Resizer plugin automatically resizes embedded videos to fill up the entire content space. It expands the video if the content area is larger and contracts if it is smaller. My first…

Continue Reading…