Objective

To restrict access to a page at a given point in time using mod_rewrite in .htaccess on pages that rely on FrontPage Server Extensions.

The Rewrite

Here are the .htaccess rules for time-based redirection:

RewriteEngine On
RewriteBase /
RewriteCond %{TIME} >20080722000000
RewriteRule ^(/?|index\.html)$ /some/other/resource.html [L]

The first two lines of the rule turn on the rewrite engine, and set the base URL to the web root. The third says if the time is greater than midnight on July 22, 2008, then rewrite requests for either this directory (/) or this directory's index file (/index.html) to /some/other/resource.html.

Caution

Add the additional rules after the part of the .htaccess file that FrontPage has already written to.

The Workaround

This will work for basic pages, but for pages that rely on FrontPage Server Extensions there is an extra step. You need to add:

Options +FollowSymlinks

to each of the .htaccess files in the underscored sub-directories of the current one, and all of their sub-directories, e.g.:

As above, be sure to add the new rule at the end of the file, after the FrontPage-related rules. If you add the rewrite rules to the main .htaccess file but don’t add the options rule to these other .htaccess files then people will not be able to log into /site/ (i.e. open the /site/ “web”) using FrontPage.


See also:

.htaccess Resources: