Allow access to the website only at specific times?
source link: https://www.codesd.com/item/allow-access-to-the-website-only-at-specific-times.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Allow access to the website only at specific times?
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, ...)
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]
Related Articles
Allow access to the website only at specific IPs using JavaScript / jQuery
Allow access to the website only from a specific network
Allow access to the file only from specific Lambda [s3]
Is it possible to restrict access to the website to a specific computer?
Can I block access to the network for a specific time?
Block the website for a specific time slot (maintenance activity)
Web.config allows access to the site for a specific user
Prevent indirect access to the website in PHP
Limit access to the aws instance from specific IP
allowing access to the development site via htaccess
How to deny access to the website based on the user's email address
Translate the website into a specific language, loading the page
Using php to display the object at a specific time
Nodejs, express, Ajax: the function only triggers Six Times
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK