Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8542893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:10:33+00:00 2026-06-11T12:10:33+00:00

I have limited experience with Apache and even less with RewriteRules. I hope that

  • 0

I have limited experience with Apache and even less with RewriteRules. I hope that someone can point me in the right direction on this.

Every morning, there are some scheduled tasks that execute on our server between 5:00 and 5:30am. During this time, we want to reroute web requests to an “under maintenance” page. I thought that using the htaccess page made a lot of sense because it would allow me to point the requests to a generic page without having to maintain a lot of setting changes. My question has two parts:

  1. Is a RewriteCond statement in the htaccess file compared with the current time/date the best way to go for this?
  2. Can the rule be written to prevent the direct access of a page (i.e. index.htm)? If so, can this be specified for all subfolders too?

Given that the RewriteCond TIME variable presents itself as “yyyymmddhhnnss” I’m assuming it will look something like this:

RewriteCond %{TIME} ^(([0-9]{8})[0][5][0-2][0-9][0-5][0-9])
RewriteRule .* http://mysite.com/under_maintenance.htm

Does this make sense at all? I thank you for any and all assistance you can provide.

Thanks!

Craig

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:10:35+00:00Added an answer on June 11, 2026 at 12:10 pm

    If you want this to happen automatically, you can match specifically against the %{TIME_HOUR} and %{TIME_MIN} vars:

    # hour = 05
    RewriteCond %{TIME_HOUR} 05
    
    # minute between 00 and 31
    RewriteCond %{TIME_MIN} >00 [OR]
    RewriteCond %{TIME_MIN} 00
    RewriteCond %{TIME_MIN} <31
    
    # can add other exceptions here
    
    # make sure the request isn't FOR the maintenance page    
    # redirect to maintenance
    RewriteRule !^/?under_maintenance.htm$ http://mysite.com/under_maintenance.htm [L,R]
    

    This 302 (temporary) redirects to http://mysite.com/under_maintenance.htm for every request except the maintenance page. So the answer to:

    1. Yes, you can use a RewriteCond to compare to the time, it’s a good way to automate this without having to do anything extra.
    2. This rule will prevent access to everything except the maintenance page. You can vary this by adding additional conditions before the RewriteRule, for example, if you want to allow /special_page.htm, then you’d add:

      RewriteCond %{REQUEST_URI} !^/special_page.htm$
      

      and if you want to allow all iamges and css, then you’d add:

      RewriteCond %{REQUEST_URI} !\.(css|png|jpe?g|gif|ico)$ [NC]
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me preface this with.. I have extremely limited experience with ASM, and even
In my limited experience, I've been on several projects that have had some sort
I have limited JS experience, and I need to split a string that would
I have a pretty limited experience with AJAX and javascript so hopefully this is
This is a question about design approach. I have limited COM experience and a
I have limited experience with .net. My app throws an error this.dateTimeFormat is undefined
I have limited experience with joins, and this puzzle has me stumped. Here are
This might come across as a simple question, but I have very limited experience
I will advise you prior that I have limited JavaScript experience. Currently, I have
I have a database with limited external connections(up to 5). Because of that reason

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.