skip to Main Content

Im trying block websites in certain hours, but i cant use correctly the rewrite cond or what is the better way?

<IfModule rewrite_module>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.facebook.com$ [NC]
RewriteCond %{TIME_HOUR} ^(11|12|13|14|15)$
RewriteRule .? /restrinction_social.html [L]
</IfModule>

2

Answers


  1. are you trying to block the website so you can internal network can not access it?
    the .htaccess is for domains hosted on your server your configuration could work if your server is the host of facebook.com
    if you are trying to block your internal network to access facebook.com maybe you can do it with DNS or a PROXY server like squid

    Login or Signup to reply.
  2. You may try this procedure on how to block website on your network through httpd.conf.

    1. Navigate to your Apache installation directory, which is typically the /etc/httpd/conf directory on most servers. The path to the installation directory is case-sensitive.

    2. Locate the httpd.conf file in the conf directory, and then open using vi command or your text editor. You can use cp command to create a backup. Please see the sample below:

    $ cp -R httpd.conf httpd.conf.bak

    1. Scroll down to the “ProxyBlock” line.

    2. Enter the domains you want to block in the “ProxyBlock” line. Add the domain name to block after the last domain name. You do not need to add a comma — just add a single space after the last blocked domain name. Please see the sample below:

    Proxy Block google.com facebook.com

    1. Save the file to the server, making sure to preserve the file’s case-sensitive name. Test that the file is working properly by trying to visit the blocked websites using a computer located on your network.

    Hope this information works for you.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search