Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm setting up a simple web site for a member of my family, using wordpress as a CMS. I've already registered a domain name and I'm about to set up wordpress. I want them to be able to edit the site content online (using wordpress's admin interface) and view the site, but I don't want the site to be available to the public while it's in the editing stages.

Can anyone suggest a good way to prevent access to the public (for example a "coming soon" page, but access to the main site via a password; or perhaps put the wordpress installation in a subdirectory while the site is in the editing stages, and then use url rewriting to redirect the root directory to the subdirectory when the site goes live).

I should mention that I'm relatively new to wordpress, so if this kind of functionality is built in I apologise for asking the question.

share|improve this question
add comment

migrated from stackoverflow.com Feb 14 '11 at 15:34

This question came from our site for professional and enthusiast programmers.

6 Answers

up vote 2 down vote accepted

I also have had problems with the maintenance plugins. What you can do instead (if you are familiar with HTML) is create a simple "Closed for Maintenance" page. Save the page as xindex.html. Upload the xindex.page to the same directory as your WordPress installation.

You Wordpress installation comes with two files index.html and index.php. While you are working or doing maintenance to your site, first rename the existing index.html file as realindex.html then rename the xindex.html that you uploaded as index.html. This will replace the Wordpress homepage with your maintenance page.

When you are finished working and are ready to display your site, reverse your steps. Rename the current index.html back to xindex.html and change realindex.html back to index.html. Sounds more complex than it is in practice, but it entirely avoids buggy plugins.

Here's a link to my maintenance page. You can copy the source. Closed for Maintenance

share|improve this answer
    
This looks like a good solution, and I'm going to implement it. If anyone can think of a reason not to use this method, please let me know. –  Tomba Feb 14 '11 at 17:15
add comment

If you know how to, just set up apache basic authentication - this will give you a little dialog box that asks for a username and password.

The main advantage is that you don't need to change your WP setup, and any authorised user can see the front end. Once you're ready, turn it off, and you're good to go

share|improve this answer
    
I did consider this, but since I don't have much of a wp setup at the moment, I'm not to worried about changing it. –  Tomba Feb 14 '11 at 17:16
add comment

There is number of plugins that show up maintenance pages, but I personally had trouble with that (plugin conflicted badly with something and almost knocked out server) and stay away from those since.

My personal preference is Members plugin, it has (among other things) easy to use private mode that will prompt for WordPress login to see anything on site.

I'd stay away from redirects for something simple, it is always better to develop as close to final URL structure as possible.

share|improve this answer
    
Thanks, I will look into the members plugin. Even if I don't use it in this case, it looks like a useful thing to know about. –  Tomba Feb 14 '11 at 17:15
add comment

or you can put this AS THE FIRST THING in your wp-config:

///////////////////////////////////////////--start, change before going live
//temporary IP-based redirect

//IPs: mine:go to whatismyip.com to find it

$allowedips = array("my.dev.ip.here");
$userip =$_SERVER['REMOTE_ADDR'];
if( !in_array($userip, $allowedips) )
{
    header('Location: http://cnn.com/');//or wherever you want
    exit;
}
//////////////////////////////////////////--end
share|improve this answer
add comment

You could also simply enable the WordPress privacy setting to block search engines. If this is a new site with no links from other sites, nobody would be able to find it in the first place (unless they knew the specific URL). Admittedly, this isn't really "hiding" the content per se, since anyone can visit the site and see the content, but if people can't find it in the first place, that's kind of the same thing, right?

(The "Site Visibility" setting is under Settings > Privacy Settings.)

share|improve this answer
    
True. I will do this anyway. –  Tomba Feb 15 '11 at 8:54
add comment

Another simple answer is to write a "coming soon" page or whatever you want, and then name that file home.php. Drop this file into your theme and WordPress will automatically make this your home page. Your Wordpress pages are still accessible to anyone who knows the right URLs. When you're done setting up, just delete this file.

Note, this only works if you HAVEN'T set a static home page under Settings -> Reading.

I would also "hide" the site from search engines under Settings -> Privacy. WP reminds you that search engines are blocked, so just unblock after you're through constructing the site.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.