WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: sky writer on July 07, 2015, 06:30:46 AM

Title: FrontEndLogin Script - keep visitors and google away when building your site
Post by: sky writer on July 07, 2015, 06:30:46 AM
Ruud created a great script featured here - http://wbhelp.org/tips-and-tricks/2014/keep-visitors-and-google-away-when-you-are-building-your-website/

I've used it on many sites and it really helps with the proofing process with clients.  I have noticed that after I successfully enter the password and see the site, I am met with the password screen again when I click on a menu item.  It's never bothered me, but I have a client who has become annoyed with constantly having to enter the password twice each time he reviews the site.  I know, what a hardship this must be.  But he has asked if this can be fixed.  I really don't know what might be causing the behaviour.

If Ruud or anyone else could give a suggestion, it would be greatly appreciated.
Title: Re: FrontEndLogin Script - keep visitors and google away when building your site
Post by: Ruud on July 07, 2015, 10:21:53 AM
Maybe it is like this:

A successfull login is kept by storing a value in a session variable.
If you login in domain.tld and the menu is pointing to www.domain.tld it will ask the question again because a new session is created.

If this is the case, you can force the visitor to go to www.domain.tld by using a few .htaccess lines:
(if you are using shorturl put it above the shorturl lines)
Code: [Select]
RewriteEngine On
# rewrite host to include www
RewriteCond %{HTTP_HOST} !^www\.               [NC]
RewriteCond %{HTTP_HOST} ^([^.]+\.[a-z]{2,6})$ [NC]
RewriteRule ^(.*)$       http://www.%1/$1      [R=301,L]