Forum Topic: One page only Maintenace Mode

Forum: .htaccess Forum : Redirecting • Posted by Jeroen • Updated:

Jeff, another excellent question!

When I am updating my website, I often don’t update every page. Mostly I’m just working on one page when I want to make some layout changes (yeah yeah yeah, I could work on it locally first, but the files are on one computer only and not always available).

These are the Maintenance lines for the whole website

# TEMP MAINTENANCE PAGE
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^123\.456\.789 
# RewriteCond %{REMOTE_ADDR} !^111\.222\.333	 
RewriteRule .* - [R=503,L]
Header always set Retry-After "3600"

but what do I need to do to make only one page in Maintenance Mode?

Something like this didn’t work for the page produk…

# TEMP MAINTENANCE PAGE
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^123\.456\.789
RewriteCond %{REQUEST_URI} /produk 
# RewriteCond %{REMOTE_ADDR} !^111\.222\.333	 
RewriteRule .* - [R=503,L]
Header always set Retry-After "3600"

Thanks in advance

Jeroen

8 Replies to “One page only Maintenace Mode”

Posted by Jeff Starr

Hi Jeroen,

Yes! Great question :) This is tested to work:

# TEMP MAINTENANCE PAGE (for specific page)
<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteCond %{REQUEST_URI} /produk [NC]
	RewriteCond %{REQUEST_URI} !/maintenance [NC]
	RewriteCond %{REMOTE_ADDR} !^123\.456\.789
	RewriteRule .* - [R=503,L]
</IfModule>
<IfModule mod_headers.c>
	# 3600 = 60 minutes
	# 86400 = 1 day
	Header always set Retry-After "86400"
</IfModule>

Also, if there are any other mod_rewrite rules in the .htaccess file, try placing these rules before them. Sometimes that makes a difference as well.

Let me know how it goes!

Jeff

PS: use pre tags for multiple lines of code, or code tags for single words and small phrases.

Posted by Jeroen •

Works great, Jeff. Thanks!

In my wonderful trials to get this to work, I forgot to create the actual 503 page on the server. Again…

Please remind me next time I ask the same kind of question ;)

Btw, still no notification email when there is a reply to a post I subscribed to on this website. Strange.

Jeroen

Posted by Jeff Starr

Glad to hear, Jeroen!

About the emails – I think it’s an issue with one of the plugins I’m using, and will try to get it fixed up after finishing my next book (due out next month).

Posted by Jeff Starr

Hey Jeroen!

I think I figured out why emails weren’t sending, so I’m posting this follow-up reply to see if it worked.. Let me know! :)

Posted by Jeroen •

Received your last reply loud and clear!

Book about what? Can I buy it? :)

Posted by Jeff Starr

Awesome! Glad it’s working again :)

Yep, it’s a new book about WordPress that should be available in May. I’ll be sending an announcement email about the “pre-launch” sale for people who have purchased either of my other books (.htaccess made easy and/or Digging into WordPress), so they can get a discount ;)

Stay tuned!

Posted by Jeroen •

Damn. Just saw this last reply of yours, which I didn’t get in my mail box. Is the email not working again? Anyway, I’m going to post a new question to find out ;)

Looking forward to the two emails I am going to receive from you. One from DIW and the other one from .htaccess made easy. Always a pleasure to read interesting things! I’m going for the discount!

Posted by Jeff Starr

Hmm.. it should have been working (could have sworn I fixed it).. I’ll keep my eyes peeled and see if anything else looks suspicious. (Thanks for the heads up!)