Jump to content

Password protect Mutltistore shop


Recommended Posts

I am hoping that someone can help me. I have Multistore enabled with a retail site and a wholesale site.

I am using a sub-domain for the wholesale store.

 

I would like to add a password to enter the wholesale site.

 

Is this possible and if so how please?

 

TIA

 

-Jeffro

Link to comment
Share on other sites

  • 3 months later...

I have managed to enable multistore ans password protect one shop with password.

 

1/ (Main shop) retail store open to public ------ domain.com

 

2/ (Wholesale shop) subdoman password protected ---- sub.domain.com

 

 

domain.com is in root directory

 

sub.domain.com is set up in cpanel to point to domain.com root directory

 

 

 

In the domain.com htaccess file after  

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

 

you can add this as a conditional statement

which says if user is on subdomain ask for password if not then Ok

 

 
 
#Substitute sub.domain.com for your subdomain name
SetEnvIf Host ^sub\.domain\.com$ is_on_sub_.domain
Order deny,allow
Deny from env=is_on_sub_domain
# require password if access would otherwise be denied
Satisfy any
# Put your password auth stuff here
  AuthName "Password Protected Area"
  AuthType Basic
#Substitute domain.com and absolute path to your domain.com directory.
  AuthUserFile /home/user/public_html/domain.com/.htpasswd
  Require valid-user
 
 
So when a user goes to your main site all is good
When a user goes to your subdomain  they are greeted with  user/password to enter site
 
 
Hope this helps :)
Link to comment
Share on other sites

thanks for sharing syntax, how does one update the server?  using putty to update text file with passwords?

 

 

 

Personally I  use Filezilla to upload/ edit the .htpasswd file to a directory of your choice preferably outside of the root directory.

you can generate a .htpasswd file here

http://www.htaccesstools.com/htpasswd-generator/

 

An if you need to update the htpasswd just repeat the process.

 

Imo the module you mentioned dosnt really encompass password protecting a whole domain completely

I prefer to keep the whole site from prying eyes and give the user/pass to trusted wholesale clients.

the basic purpose is just to prevent general public from seeing the wholesale site.

And restricting search bots from indexing the wholesale subdomian through robots txt files.

although not 100% bullet proof maybe the implementation of hiding prices would be a secondary

layer of privacy. 

 

i had thought of trying to introduce a conditional statement where you could alter the css attributes which display the prices 

dependent on whether a a user was logged in or not

 

such as below in pseudo code:

 

If logged in then use thisstyle.css

------ default css

if not logged in then use thisstyle.css

----- puplic_default.css

with

.price_attributes, .price_displayed_on_site

{

display:none;

}

 

Something along those lines

Although this dosn't stop someone after logging in or compromising your htacess rule from inspecting the source and changing the css on the fly to see your prices, its however a simple  method to make it awkward to view you're site or see prices.

 

Being fairly new to Prestashop Im not sure where I would use this kind of statement.

 

 

Edited by r00Syntax (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...