Can you block URLs with Tasker? Is it possible to block URLs with Tasker?

I'd like to block different sites from 9-5 everyday.
You can if your device is rooted. You need to add the URLs in the hosts file (/etc/hosts) like:
127.0.0.1 facecrook.com
127.0.0.1 liveminmin.com

and so on.
Note that you'll have to remount (as rw) your /system first using the commands:
adb shell
su
mount -o remount,rw /system

Use a file editor to do the editing and then remount the system in ro mode. Also, before editing, copy the default hosts file at some location say /sdcard/host_files/original/hosts and the modified hosts file at /sdcard/host_files/modified/hosts
Now with the Tasker:

Create a time based profile as + → Time and select your timing when you want URLs to be blocked.
Create a task under the above profile and the action inside it should be + → Code → Run Shell:


Type mount -o remount,rw /system in Command
Check Use Root


Create a new action through + → File → Copy File:


Tap the lens icon corresponding to From and select /sdcard/host_files/modified/hosts
Tap the lens icon corresponding to To and select /etc folder by holding it.


Create another new action through + → Code → Run Shell:


Type mount -o remount,ro /system in Command
Check Use Root


Create this last action through + → System → Reboot → select Normal in Type.
Create another profile for the time you don't want URLs to be blocked using step1.
Copy steps 2-5 and choose /sdcard/host_files/original/hosts in step 3 under From.
Make Tasker an exception in any app (if you have) that disables Tasker from startup.

Enjoy!