• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 598
  • Last Modified:

How do I temporarily block all access to a Wordpress website

I have a wordpress website that I want to take down temporarily. How do I do this elegantly and without changing anything so that I can easilty put it back up again.

Thanks
0
DavidHannen
Asked:
DavidHannen
1 Solution
 
DmitriyCommented:
0
 
Ray PaseurCommented:
Add the PHP die() command to the first-called script.  Probably either wp-blog-header.php or wp-config.php
0
 
gwkgCommented:
If you want to redirect to a page that describes why your site is down, put this code in functions.php.

function maintenance() {
  $url = "http://google.com";
  header("Location: $url");
  }
add_action('init','maintenance');

Open in new window

0
 
c_a_n_o_nCommented:
Another way without editing your WordPress or Theme files, is to add code to your .htaccess file that would deny access.  The site offers several options to choose from.
Source: http://25yearsofprogramming.com/blog/20070704.htm

Simplest method

ErrorDocument 503 "Our website is temporarily closed for maintenance. It should reopen by..."
RewriteEngine On
# TO ALLOW YOURSELF TO VISIT THE SITE, CHANGE 111 222 333 444 TO YOUR IP ADDRESS.
RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$
RewriteRule .* - [R=503,L]
0
 
DavidHannenAuthor Commented:
Thanks - just what I was looking for
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now