Manisch Posted February 22, 2017 Share Posted February 22, 2017 Hello, I would like to give my shop a password-protection as an alternative for the maintenance mode. But I guess I'm doing something wrong... 1. Where do I place this file? I thought in the root-folder of the shop, which would be /httpdocs...? 2. There is already a .htaccess file. Can I just paste the password-part inside it? Anyplace? Somewhere specific? That's what I did, at least I thought so. But there won't be any pop-up that asks for a password... Link to comment Share on other sites More sharing options...
Manisch Posted March 2, 2017 Author Share Posted March 2, 2017 Anyoooone? (: Link to comment Share on other sites More sharing options...
El Patron Posted March 3, 2017 Share Posted March 3, 2017 for this it's best to search outside of PrestaShop as it's serve specific. http://www.htaccesstools.com/htaccess-authentication/ https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-apache-on-ubuntu-14-04 and there a lot more out there. Link to comment Share on other sites More sharing options...
Manisch Posted March 3, 2017 Author Share Posted March 3, 2017 for this it's best to search outside of PrestaShop as it's serve specific. http://www.htaccesstools.com/htaccess-authentication/ https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-apache-on-ubuntu-14-04 and there a lot more out there. Thank you for those. But I already googled and tried that. So my initial question is more about what I'm doing wrong. Because right now I see zero effect after setting it up :/ Link to comment Share on other sites More sharing options...
Manisch Posted March 4, 2017 Author Share Posted March 4, 2017 I just tried over and over again. It just doesn't work... Link to comment Share on other sites More sharing options...
Rhobur Posted March 4, 2017 Share Posted March 4, 2017 you have to add something like this into your .htaccess file: AuthName "Forbidden" AuthType Basic AuthUserFile /var/www/yourdomain/.htpasswd Require valid-user And then add the user:password hash into htpasswd 1 Link to comment Share on other sites More sharing options...
razaro Posted March 4, 2017 Share Posted March 4, 2017 Well try this, used on one site and was working. In your PrestaShop root .htaccess after #end line add this Order deny,allow Deny from all AuthType Basic require valid-user AuthUserFile "/home/yourhostingaccount/.htpasswds/public_html/passwd" AuthName "Protected public_html" Satisfy Any ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=/failed.html\"></html>" Important thing is full path to paswd file in AuthUserFile. Change to your real hosting account. For passwd file you use generator El Patron mentioned http://www.htaccesstools.com/htpasswd-generator/. Also note that part after .htpasswds. You need to create folders there that match your root prestashop folder. Here is just public_html. You can also add line Allow from 1.1.1.1 and change IP to one that access a lot and should bypass password prompt. If password is wrong you could add error document failed.html that is on same level like puplic_html 1 Link to comment Share on other sites More sharing options...
Manisch Posted March 7, 2017 Author Share Posted March 7, 2017 I guess one thing that was missing was the line "Require valid-user". I managed to at least get the Login-Popup, but after entering the password, I got redirected to an error-page. So there was probably still something wrong with the path to the password-file. While investigating the correct part, I found an option to activate a password in the server's controlpannel, which turned out to be the most easiest way. But thanks to everyone who answered. I'll mark razaro's answer as the solution, because I guess it might be the most useful one if others someday search this thread. Link to comment Share on other sites More sharing options...
TinyStore Posted February 8, 2018 Share Posted February 8, 2018 Thanks razao, your solution works for me Link to comment Share on other sites More sharing options...
espacious Posted May 15, 2018 Share Posted May 15, 2018 (edited) Hi there, i used .htaccess and .htpasswd to make my Pestashop password protected. The user/pass form shows up and when i enter the correct credentials i can enter the site. But there are no images no css, etc... seems only plain text... Any advice? Thanks ---------------------------------- Ok i found a suitable solution. I used Cpanel protected directories. Now in .htaccess file i see this: (if someone has no Cpanel) # ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again AuthUserFile "/home/user/.htpasswds/domain.com/passwd" AuthType Basic AuthName "Protected Area" require valid-user Note that passwd is saved outside the root dir. Edited May 15, 2018 by espacious Solution found (see edit history) Link to comment Share on other sites More sharing options...
espacious Posted May 15, 2018 Share Posted May 15, 2018 (edited) One last thing. If i enter a wrong password i dont get redirected to an error page intead the enter user/pass window shows again over and over. .htaccess looks like this: Order deny,allow Deny from all AuthType Basic require valid-user AuthUserFile "/home/yourhostingaccount/.htpasswds/public_html/passwd" AuthName "Protected public_html" Satisfy Any ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=/failed.html\"></html>" Edited May 15, 2018 by espacious misclick (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now