Deny access to a folder based on the Time

Security in htaccess: htpasswd, 401 Authentication

Deny access to a folder based on the Time

Postby produke » 03 Oct 2006 02:15

If for some reason you would like to block access to files in a directory during a specific time of day, you can do so by adding the following code to an .htaccess file.

Code: Select all
RewriteEngine On
RewriteCond %{TIME_HOUR} ^16$    # If the hour is 16 (4 PM)
RewriteRule ^.*$ - [F,L]  # Then deny all access

RewriteCond %{TIME_HOUR} ^16|17|08$ # Multiple hour blocks, 4 or 5 or 8 AM
User avatar
produke
 
Posts: 242
Joined: 25 Sep 2006 04:48

Return to Security and Authentication



Who is online

Users browsing this forum: No registered users