Jump to content

Login issues, login redirection, htaccess, cookie issues?


Recommended Posts

I have been noticing some problems lately and am not sure what the issue is.

 

The major problem is that users cannot login in front office. They enter login info (including myself) and they get redirected back to the login page like nothing happened and they are not logged in.

 

We have tried clearing cookies, clearing cache, using different browsers, and none of it works.

 

Also, I noticed that I sometimes when I try to view the products list in BO catalog, the products do not show up. I have to clear cookies and log back in to see it. The issue comes right back after I try to use the stock management page sorting tools.

 

I have had ongoing cookie problems for some time now that seem to come and go oddly.

 

Please help asap. All my sales have stopped.

 

Version 1.5.2

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

funny thing, i had the same issue when I installed the latest 1.5.2 version, so I'm currently with a 1.5.2 version I downloaded a month ago wich has different issues, but not so critical.

 

What is no joke is this: I have two 1.5.2 versions with different authentication.tpl files, with same file version number and different content. And both give different problems.

 

The guys at Presta gonna have a nightmare sorting bugs, as same versions give different behavior.... and users are lost in a maze, too bad

Edited by josecar (see edit history)
  • Like 1
Link to comment
Share on other sites

I noticed something that might be causing a conflict. In the shop domain and ssl domain, I had the www in there. I also had canonical redirect setting turned on. I removed the www, turned off canonical and back on, then reset the friendly url to on and the login is working again. However, the canonical redirect is NOT working. i tried turning it off and on, but will will not redirect to www.

 

I think that there may be a conflict if you add the www to the domain settings while also enabling the canonical redirect setting. If that is the case, there should be a note in BO that says "do not add www". Can anyone else confirm this? I got the idea when I saw the suggested solution for other people was to remove the www.

 

I do not want to use my site without the www, so I need a solution.

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

Oh... I see... so the canonical redirect is just redirecting to what I set in the domain. Not specifically the www. I tried adding the www to the domain settings again and testing with canonical redirect on/off and find that no one can log in again. What is the problem and how do I get it to use the www?

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

I just realized something. The friendly urls are not getting updated when a change is made to the canonical url setting or the domain setting. You have to enable/disable the friendly url to get the correct updated htaccess. This is a problem as people do not know to change those settings in that order. You can see what I mean if you view your current htaccess file on the server with the following steps...

  1. Have friendly urls on.
  2. Note what your current domain url is (with or without www).
  3. View your htaccess file on the server. Note the structure of the friendly urls (with/without www).
  4. Now change the domain url in BO to the opposite (with/without) www.
  5. Refresh your view of the htaccess on the server.
  6. Note that the primary domain setting changes, but the friendly url settings do not update to reflect the domain change.
  7. Now go into BO and disable/enable friendly urls.
  8. Refresh your view of htaccess again and you will see the friendly urls are now showing the correct structure.

If my testing is correct, which I believe it is, this would be why so many people get confused and why it seems that the settings are not working. I think some testing needs to be done in regards to how the changes to these settings are applied to the htaccess when they are done in variable order. Someone please test and confirm this issue.

 

Also, this realization has not corrected my issue of not being able to login on the www domain.

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

How would changes to those settings be applied then if the system does not regenerate the htaccess file? The typical user might change the domain url, but not know that they need to disable and re-enable the friendly seo setting so all their urls are updated accordingly. That would then cause all kinds of problems. Like I experienced. If you search google for similar issues, you will see a lot of people have posted issues pertaining to this, which I believe could all be tied in to the way these settings are handled. You can't change the domain url and not update the friendly urls without having problems, which is what is happening.

 

Changing a setting like canonical urls, domain url, and ssl domain should auto generate an updated htaccess. Or, there should be a button to generate the htaccess in that section with a note that says you must do it to enable the changes. It makes no sense that you would have the options to change the settings, but not apply them correctly and automatically to the htaccess.

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

I didn't have a chance to look at it with the www. on it before you disabled it.

 

I turned it back on, so the problem is back. Please check it out asap. It is returning customers trying to log in and new customers on the second registration step that get redirected back to the login page. This is only a problem when using the www domain. Not a problem without it. Also, you can message me on the store's skype if you want. buyrotmgitems

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

When developing my own multishop I had issues with www or lack of.

 

If you would like to try this, it resolved it the issue for 1.3 and 1.4.

 

Note not tested on a 1.5. Place the code in config/config.inc.php after the loadConfiguraiton call.

 

$host = (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']);
if (str_replace('www.', null, Configuration::get('PS_SHOP_DOMAIN')) == (str_replace('www.', null, $host)))
 Configuration::set('PS_SHOP_DOMAIN', $host);

 

fingers crossed

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

When developing my own multishop I had issues with www or lack of.

 

If you would like to try this, it resolved it the issue for 1.3 and 1.4.

 

Note not tested on a 1.5. Place the code in config/config.inc.php after the loadConfiguraiton call.

 

$host = (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']);
if (str_replace('www.', null, Configuration::get('PS_SHOP_DOMAIN')) == (str_replace('www.', null, $host)))
 Configuration::set('PS_SHOP_DOMAIN', $host);

 

fingers crossed

 

How should I have the BO settings in conjunction with this code?

Link to comment
Share on other sites

When developing my own multishop I had issues with www or lack of.

 

If you would like to try this, it resolved it the issue for 1.3 and 1.4.

 

Note not tested on a 1.5. Place the code in config/config.inc.php after the loadConfiguraiton call.

 

$host = (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']);
if (str_replace('www.', null, Configuration::get('PS_SHOP_DOMAIN')) == (str_replace('www.', null, $host)))
 Configuration::set('PS_SHOP_DOMAIN', $host);

 

fingers crossed

I have same issue in v1.5.2 and I have post a topic here: http://www.prestasho...age__p__1023059

 

I am asking if they tried the code I suggested.

Link to comment
Share on other sites

Hi,

 

I have the same problem in version 1.5.0.17. I tried the code Elpatron and it does not work.

 

I'm desperate with this problem. does not help me migrate to 1.5.2 as it has the same problem.

 

You can confirm that funcioan Elpatron code in 1.5.2?

 

Thank you.

jorbarca.

Link to comment
Share on other sites

just finished looking at 1.5.2 based system on the localhost...I don't have a remote install to test this with...but from doing some searches I do not think the code would work on 1.5.

 

try this;

set your url in the back office with www

then add this to your .htaccess, this will set all inbound url's with www.

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.

RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

  • Like 2
Link to comment
Share on other sites

just finished looking at 1.5.2 based system on the localhost...I don't have a remote install to test this with...but from doing some searches I do not think the code would work on 1.5.

 

try this;

set your url in the back office with www

then add this to your .htaccess, this will set all inbound url's with www.

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.

RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

 

 

Where do it add this code in htaccess?

 

Do I replace the code in red here??

 

 

 

comment when .htaccess will be generated again

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution

# http://www.prestashop.com - http://www.prestashop.com/forums

 

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.mydomain.com$

RewriteRule . - [E=REWRITEBASE:/]

RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

 

# Images

 

 

thanks in advance

Link to comment
Share on other sites

Where do it add this code in htaccess?

 

Do I replace the code in red here??

 

 

 

comment when .htaccess will be generated again

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution

# http://www.prestashop.com - http://www.prestashop.com/forums

 

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.mydomain.com$

RewriteRule . - [E=REWRITEBASE:/]

RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

 

# Images

 

 

thanks in advance

 

yes in your .htaccess...do not change anything...

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

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

Ok that didn't work for me.

 

The thing is users can login is firefox but not chrome or explorer.

 

that sucks...sounds to me like a theme issue...are you using default ps theme...or another theme? if another theme...and if you are comfortable (i'd back up my site first) revert to default ps theme...maybe post your url as well...

Link to comment
Share on other sites

Chrome worked the other day though. before i changed the store to www. prefix Still think it's the theme. I am using a prestatheme maker theme http://prestashop-theme-maker.com

 

don't know...I fixed my 1.4 with php code...i.e. my multishop module will compare in bound http to our table of domains (but not comparing with www), if it matches it will update the shop url...I don't run a prod 1.5 shop...and my 1.4 code will not work in a 1.5 shop...maybe someday...

Link to comment
Share on other sites

Well for some reason it is worlking now. I forced the theme to recompile. and flicked some of the caching settings on and off before that. Thanks for the assistance elpatron Not sure what fixed it though. I might compare the htaccess file to the one i backed up before i did all of this to see if there is a difference.

Link to comment
Share on other sites

I want to point out that changing some settings in BO will cause the htaccess file to be overwritten by the system and updated. Won't that overwrite any of the manual changes made that elpatron suggested adding to the htaccess? Thus, making the fix break if you ever try to change certain settings in BO?

Link to comment
Share on other sites

I want to point out that changing some settings in BO will cause the htaccess file to be overwritten by the system and updated. Won't that overwrite any of the manual changes made that elpatron suggested adding to the htaccess? Thus, making the fix break if you ever try to change certain settings in BO?

 

this is a correct statement...they would be overwritten...and 1.5 no longer has the .htaccess panel to add manually....

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

i also have the same issue.

it's coming and going. cannot login to front office.

also when i face the issue (cannot login), i face a cart issue too, i cannot add only one product. when i add another product, cart is erased and i'll have the latest added product in cart. when i have a product in cart, and i just browse to another product, cart content is lost.

I have this with all browsers randomly. if i clear all browsing data, site works again for a while.

i'm not sure what causes issue to occur again, but when it occurs, i doesn't disappear until i clear all browsing data (cache cookies etc).

Link to comment
Share on other sites

  • 1 month later...

i also have the same issue.

it's coming and going. cannot login to front office.

also when i face the issue (cannot login), i face a cart issue too, i cannot add only one product. when i add another product, cart is erased and i'll have the latest added product in cart. when i have a product in cart, and i just browse to another product, cart content is lost.

I have this with all browsers randomly. if i clear all browsing data, site works again for a while.

i'm not sure what causes issue to occur again, but when it occurs, i doesn't disappear until i clear all browsing data (cache cookies etc).

 

Try using http://yourdomain.com to login and then http://www.yourdomain.com (note the www). See if one lets you log in. There seems to be a lot of issues with the htaccess and friendly url settings.

Link to comment
Share on other sites

  • 2 weeks later...
  • 6 months later...

I am having this issue on PS 1.5.6 on multishop environment. I have to shops: Shop A and Shop B. If set the main URL of each shop with "www" the users cannot login on the frontend, you just get redirected to the same page and nothing happens. 

 

If I set the main URL of each shop without "www" and add the domain with "www" as a secondary domain I have the same issue. But if I don't add both domains (with and without "www") for each shop, if I type the domain for Shop B with www (or w/o, depending on what is set up on the BO), I get redirected to the main domain on shop A, which is pretty bad... because it is a different site. 

 

Is nobody else having this issue? Any idea?

Link to comment
Share on other sites

  • 3 years later...
×
×
  • Create New...