you dont need a plugin for this, just place this bit of code in the header.php
<?php
global $userdata;
get_currentuserinfo();
if($userdata->ID!=”YOUR ID”){
header(‘location: redirectedPageURL’);
}
?>
This is simple and dirty but would just redirect anyone that was not logged in with your account to the redirectedPageURL.
Simple, quick and to the point
Thread Starter
TommeN
(@tommen)
Spmple, dirty but brilliant. Just what i needed π thanks.. But, where should i put it? In the bottom of the header?
Thread Starter
TommeN
(@tommen)
That did’nt work actually…
Thread Starter
TommeN
(@tommen)
Sorry, ive put wrong ID in the code. It works
Place it right at the top of the header.php before anything else loads.
As your only wanting this while you make some changes id keep it like this, but if you wanted something like this as a feature i would create it as a plugin and have it run before WordPress initaites.
I have a similar setup on mEm-Gaming.co.uk where on some pages like user profile pages i dont want mine or clan members profiles to show up on the profile page but to redirect them to the roster page, so i have a simple is_midnightEvil() function which basicly checks to see if the users role is either midnight evil or has the capability is_midnightEvil.
Im glad the above works for you though π
Try this plugin to make WordPress temporarily unavailable:
http://blog.taragana.com/index.php/archive/wordpress-plugin-to-make-your-blog-temporarily-unavailable-for-maintenance/
You can custumize the “offline message” or site
Works great!
The redirect doesn’t seem to be working, are there any other ways one can make a wordpress blog go offline, but an admin can still edit?
Can anyone explain why, with this method (as discussed above):
<?php
global $userdata;
get_currentuserinfo();
if($userdata->ID!="YOUR ID"){
header('location: redirectedPageURL');
}
?>
and using Mozilla, when I go to http://www.mysite.com, I am NOT redirected, but when I go to mysite.com (without the www.), I am redirected. And with IE, I am redirected with either the www before the url, or without the www.
You could put a redirect in your .htaccess file if you’re on an apache server. Just add:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_HOST} !^888\.888\.888\.888
RewriteRule $ /maintenance.html [R=302,L]
where those 8’s represent your IP address (so it doesn’t block you out).