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.
# MAINTENANCE-PAGE REDIRECT
<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]
</IfModule>
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:
<Limit GET POST PUT> order deny,allow deny from all allow from 123.456.789 allow from 123.456.789 </LIMIT> ErrorDocument 403 /custom-message.html <Files custom-message.html> order allow,deny allow from all </Files>
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)







I am using the second example code above but how do you allow images to be displayed on the maintenance page?
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 !
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:
http://sivel.net/2009/06/wordpress-maintenance-mode-without-a-plugin/
http://sivel.net/2009/06/wordpress-maintenance-mode-without-a-plugin-part-2/
http://sivel.net/2009/10/wordpress-maintenance-mode-without-a-plugin-part-3/
That’s really neat Brad. Didn’t know about it. Let me upgrade the article real quick.
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!