Nội dung
Introduction
In some cases, if you need to edit the code or for some reason, you want to block users from accessing your website for a certain period but do not know how, then this article is the solution for you.
Configuration Guide
NOTE: Check the system Date-Time before using the rules. Because the rules will be calculated according to the system Date-Time.
Block access by a specific date
The following are the TIME_WDAY values corresponding to the days of the week:
For example, I will block website access on Sunday, and the corresponding TIME_WDAY value is 0.
Now I access the Document root of the website that needs to be blocked, find and open the .htaccess
file of the website, and add the following rule:
# Chặn truy cập website vào ngày Chủ nhật.
RewriteCond %{TIME_WDAY} ^0$
RewriteRule ^.*$ - [F,L]
Here is the content when added:
And the access result shows 403 Forbidden as successful.
Block access by a specific time
Below are the parameters and their definitions that you need to pay attention to.
- Block a specific time frame (calculated time: 24 hours 1h > 24h)
For example, I will block website access at a specific time frame: 13 o’clock. Then the blocking structure would look like this:
NOTE: When you choose 13 hours, the application time will be calculated from 13h00 > 13h59.
# Chặn truy cập website vào 13 giờ.
RewriteCond %{TIME_HOUR} ^13$
RewriteRule ^.*$ - [F,L]
Here is the content when added:
And the access result shows 403 Forbidden as successful.
- Block many different time frames
For example, I will block website access in the time frames: 13h00 – 14h00 – 15h00. Then the blocking structure would look like this:
# Chặn truy cập website nhiều khung giờ.
RewriteCond %{TIME_HOUR} ^(13|14|15)$
RewriteRule ^.*$ - [F,L]
Here is the content when added:
Above are some ways that you can apply to block users from accessing your website automatically without doing it manually as before. Hope this article will help you.
You can refer to other instructions at the link below:
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com .