Password Protecting a Site

I am trying to password protect a page on my site. I am using .htaccess and .htpasswd files. It isn’t working. What do I do? My site is flench.glitch.me.

From a quick look at the developer console, I see that you’re trying to use server-sided JS on the client. This naturally throws and error, which may be preventing password protection. My suggestion is to make an input prompt when the user opens your webpage.
image

Glitch projects do not include apache automatically, you will have to remix this project to get apache on a glitch project : https://glitch.com/edit/#!/lamp-poc
Apache is required to use things like htacccess

This would work but using the web browsers developer mode they could look at the javascript file and see the pass code.

@Fleench is right, you would need a database (sqlLite is supported or a JSON file) a way to call the data (jQuery) and a way to stop people accessing the console.

See if this works!

I tried using that to access htaccess. It did not work.

got an idea- try javascript!

glitch made this basic auth example for protecting sites:

1 Like