So if you have something IMPORTANT that you really want to password protect and not allow any access at all, DO NOT USE these and try alternative means. Use the WordPress Password Protected post feature for example if you use WordPress, or if you have a static HTML webpages, use FTP to block directories or folders.
USAGE – Insert the code in between the HEAD html tags of your webpage. Remember to replace our url ‘YOURDOMAIN.com’ with the url of your webpage.
Password Protection Script 1
The username is set to ‘
SECRET_USER‘ and the password is ‘
SECRET_PASSWORD‘ – both can be set as you like. If both are right, then you are taken to the next URL, which is currently set to this YOURDOMAIN.com.
Password Protection Script 2
Insert this code in the ‘HEAD’ tags of the HTML of the web page. When you enter the page, it will ask for a password, currently set to ‘
SECRET_PASSWORD‘ (You need to change this to what you want). If the password is correct, you will be allowed to enter the page. Otherwise you can set it to redirect to any other page, currently it is set to YOURDOMAIN.com
Insert these scripts into your HTML code for simple password protection of your pages. But remember the warning as mentioned before.