Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

Redirecting Visitors to a Temporary Maintenance Page in WordPress without a Plugin

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
Redirecting Visitors to a Temporary Maintenance Page in WordPress without a Plugin

Yesterday, we showed you how to temporarily redirect your visitors to a maintenance page in WordPress using popular plugins. That method is great, but some developers prefer to get their hands dirty by going the non-plugin route. Well in this article, we will show you how to redirect visitors to a temporary maintenance page in WordPress without a plugin.

This post is part of a Series

Redirecting Visitors a Temporary Maintenance Page in WordPress with Maintenance Mode Plugin

Six Types of Maintenance Page Designs – Which One Works for You?

.htaccess Method

One method is via .htaccess that allows only single IP to access the site. This is a quick snippet for a single-developer project.

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
 RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
 RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
 RewriteRule .* /maintenance.html [R=302,L]

Basically, all you would need to do is change the Remote_Address to your IP address. Then, you would need to create a page called maintenance.html, and style it to however you like. This should be stored in your root directory. The code basically lets you see the entire site, and everyone else gets the maintenance.html page.

If you want to allow multiple IP addresses, then use this technique:

 order deny,allow
 deny from all
 allow from 123.456.789
 allow from 123.456.789
ErrorDocument 403 /custom-message.html
<Files custom-message.html>
 order allow,deny
 allow from all

Simply add as many IP addresses you want to allow. Everyone else will get the page “custom-message.html”. You can add whatever you like in the custom file.

Honestly, we think by going the WordPress maintenance plugin route is a lot easier. Question to users: Why do you think the non-plugin route is better?

Note: Brad Williams in the comment pointed out that there is another method of doing this which is actually built-in with WordPress. Check out Matt “Sivel” Martz’s Series Post (1), (2), (3)


Perishable Press (1), (2)

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Kyriakos K says:

    is there a way to exclude a page from redirection during the maintenance mode?
    thx for your response in advanced.

  2. Sue says:

    The non-plugin route is ok, but I don’t have a static IP address, so not an ideal solution.

  3. mikelking says:

    The best reason to use a static or at least non-WordPress page for your maintenance page is if you need to take down your database for any reason. One the db is down your plugin based solutions will no longer function.

  4. Dave says:

    “Why do you think the non-plugin route is better?”

    For me personally, the non-plugin route gives me two things. One less plugin to integrate into what is largely a custom coded site, so no thinking of problems along plugin conflicts. The other reason is simply that I like .htaccess controlling the show. Assuming the .htaccess code works (in any situation), one doesn’t worry about 3rd party code. I know .htaccess isn’t doing anything other than controlling access. It’s also easy to test, regardless of one’s login situation. Just change the allowed IP to something random.

  5. jaffa says:

    I am using the second example code above but how do you allow images to be displayed on the maintenance page?

  6. Grégoire Lemaire says:

    hi and thanks for this tut! i recommend the nasty plugin : coming soon page which does the same but allow you customizing from back office parameters , great time unwasted !

  7. Brad Williams says:

    I like the built-in maintenance mode that WordPress features. Most people don’t know about it, but Matt “Sivel” Martz wrote a great series of posts explaining it:

    • Editorial Staff says:

      That’s really neat Brad. Didn’t know about it. Let me upgrade the article real quick.

  8. Zach Reed says:

    I love not having to user plugins all the time for everything. I really like this method.

    A HUGE plus to doing it this way also is that is allows you to view the site without HAVING to be logged in (since it is by ip.) So now you can test features that may or may not exist when logged in verse logged out.

    For example if you had a special members only area that had special “logged in” features, you could test stuff without ALWAYS seeing those, like you would if you used a plugin and were logged in the admin.

    Great post!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.