31. March 2011
von Blackbam

Development projects should not be visible for public internet visitors in a lot of cases. Imagine you develop a project for a large company and the Google robots get you for some reason. There will be a lot of visitors who surf on your unfinished blog or website. There are a lot of Maintenence Plugins for WordPress, like WP Maintenance Mode, but this is not so good for development, as you have to be logged in all the time.


A good way to protect you from unwanted visitors is using an IP-Filter. You can do this using PHP or a configuration-file for your webserver. I like the PHP way, because it is possible kind of server. Now only you or somebody using your IP-Address will be able to see the site. Everybody else is forwarded to another site. Just copy and paste the following code at the beginning of your index.php-file in the WordPress root folder on the server:

Using PHP
/*** The IP-protectection for development time ****/
$userip = ($_SERVER['REMOTE_ADDR']); // The IP of the visitor
$ip = '127.0.13.37'; // Enter your IP here

if ($userip != $ip) {
 header("Location:http://www.company.old/"); // the URL of another site, take Google for example
} else{
 // do nothing, go on to wordpress
}

Another way is using a server configuration, like .htaccess on Apache:

Apache example
Order deny,allow
deny from all
allow from 94.136.31.33

Somebody who knows your IP-Address still can get in, so if security is really important, you should add some more security measures.

Share

Dieser Eintrag wurde am 31. March 2011 um 20:20 in der Kategorie WordPress, WP Scripts veröffentlicht. You can book the comments for this article RSS 2.0. Feedback, discussion, commendation and critics are welcome: Write a comment or trackback.


Tags: , ,

No comments yet

Kommentare abonnieren (RSS) or URL Trackback

Leave a comment: