• Hello,

    I was woundering if someone know if there is a plugin to set wordpress “offline”. I have a page online, and need an heavy theme update.

    Therefore i tought, if i could set an message for everyone that come to my page: “This page is offline. Please come back later”. But for me “as is logged in” could see the page completely fine ??

    Do you know a plugin for this?

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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:

    https://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?

    nelslynn

    (@nelslynn)

    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 https://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.

    I’m using Maintenance Mode Plugin:

    https://sw-guide.de/wordpress/maintenance-mode-plugin/

    archard

    (@archard)

    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).

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Set WordPress Offline’ is closed to new replies.