A simple way to hide your wordpress website until launch.

March 24, 2010 by: Anthony Damasco

Recently I had to revamp a website for a client. The website was using Word Press to power it and so I had to do some template editing that would make the website look very broken while I was experimenting. What I did was stop Word Press from running at all unless a get request happened.

To do this you must first find “index.php” in the root folder on your blog. It should look empty aside from loading the blog header. Then you paste in this code:

<?php
$display = $_GET['display'];

if ($display !== “yes”) {
echo ‘Post a polite message letting the user know that the site is being worked on, you may use HTML in this space’;
exit();
}

?>

After saving and uploading your modified index page, you will only see the message that you are echoing. If you want to see the wordpress blog you need to include ?display=yes at the end of your URL.

example: http://mysite.com/blog/?display=yes

Now you are free to experiment with the CSS without worrying about any users seeing the website break. If you have any questions about this, ask them in the comments.

-AD


Comments

22 Responses to “A simple way to hide your wordpress website until launch.”
  1. I just needed to take a moment and let you know that I’ve been relishing reading your posts over the last few weeks. I have a blog of my own, and would love to switch links with you. If you’re interested just leave me a comment on my page or send me an e-mail with your details.

  2. I’ve just stumbled upon your site while searching for a tutorial on an related subject. Glad I did too. There’s a lot I like. Anyway, you’ve been bookmarked and I’ll be back soon. :)

  3. Hey, I am checking this site from my iPhone and it looks kinda funky. Thought you’d want to know. It’s a great post though, didn’t mess that up :)

  4. awesome stuff, cheers man

  5. Kirby Xang says:

    Superb Post. then the simillar post I checked last Sunday on google. Keep up the great work.

  6. RSS feed is not working in chrome, Kindly fix it.

  7. neat stuff, cheers man

  8. Thanks, you guys explained everthing I needed to know and very quicly 10 out of 10!

  9. Thanks for the post! I love it!

  10. Very interesting site. Can you provide more information on this cheers?

  11. Simon Meyer says:

    Hey! I have been following your blog for 4 days now and i should say i am starting to like your posts.I guess im subscribing now for not missing anything new.

  12. I find your website very amusing. I love coming back to it each day to read additional content. Your site has been one of my favorite ones for the last few weeks and I would love to become a full time subscriber. I hope your content keeps going the way it is, and I will participate in many discussions if given the opportunity.

  13. Kudos from one brainiac to another. :)

  14. Tom says:

    Thanks for the advice. Will put it to work. Tom

  15. Dillinger says:

    If though, you have an index.html and index.php (in other words keeping the old site going pre launch) would Google pick up index.php at all? Or would this need a rewrite?

    Anyway I will try it and see. Thanks a lot for sharing this.

  16. @dillinger you’ll want to rename index.html to something else.

  17. Jim says:

    Great idea, but now none of the pages work eg http://www.website.com/?page_id=8 now brings up the echo’ed string.

    do you need to append the ?display=yes string into the page urls???

  18. Yes, so if you wanted to see your page you would do this:

    http://www.website.com/?page_id=8&display=yes

    Adding that extra variable in the url will tell you code to show the site instead of the message

  19. sina88 says:

    I used to be much more than pleased to seek out this internet-site.. some times its a pain in the ass to read what blog owners wrote but this website is really user friendly ! . A lot much more A lot much more.

  20. caffee says:

    Thanks for this. The override is working, but I can’t get the pages to load with display=yes. It’s still just the echo.

Leave a Reply