1) The web of the server depends of the type of webserver you are using. if you are using apache2 it will be "/var/www/html" or if you are using lampp it will be "/opt/lampp/htdocs" if you are using xampp in windows it can be "C:\xampp\htdocs". I am using xampp in windows so I created a directory with my last name in the webroot. I also created an index.html file which contains firstname, lastname and student id
screenshots:
To password protect the directory we can use ".htaccess" file with an ".htpasswd" authentication file which contains encrypted username and password to protect our directory. the .htaccess file should be placed in the directory and the .htpasswd should be placed out of the directory. After that we should link .htaccess file to .htpasswd for authentication
Code:
.htaccess file
.htpasswd can be generated online
After linking the files, we can successfully authenticate to our directory
To block our site access to both 101site.net and 102.104.12.12 we can restrict them through .htaccess file in the directory we created.
We use htaccess rewrite rules to deny access to the both website and ip address mentioned.
Get Answers For Free
Most questions answered within 1 hours.