Reputation: 765
Is it possible to restrict the access to a html/php website only at specific times? I have a php file on my Raspberry Pi and I already set up a .htaccess file so that users have to log in, but I also want to restrict the times of access. Users should only be able to access (or log in) the page between 7am and 1pm.
Since I have root access to my Raspberry Pi, I kind of have infinite possibilities to do so (apache2, html, css, javascript, php, ...)
Upvotes: 2
Views: 2089
Reputation: 423
You could redirect users to a different page if the time criteria isn't met with the Apache Rewrite mod. The below will issue a 403 if the time is later than 1300 and before 0700.
RewriteEngine On
RewriteCond %{TIME_HOUR} >= 13 [OR]
RewriteCond %{TIME_HOUR} < 07
RewriteRule ^/site.html - [F]
Upvotes: 2
Reputation: 497
if you have(most probably you do) a file that gets included every refresh, you could just check the time and display a "no access" page incase it falls in the time, where the site should be not accessed
Tell me if you need more help
Upvotes: -1