Forums / Installing on a Linux/Unix Server / Admin login fails when site url begins with www

Admin login fails when site url begins with www

Views: 1,234

Results 1 to 7 of 7
25 Oct 2012, 9:43 PM
#1
kephra avatar

kephra

New Zenner

Join Date:
Sep 2006
Posts:
3
Plugin Contributions:
0

Admin login fails when site url begins with www

Server: Debian squeeze, Apache2, php5, mysql.
I originally installed zencart to my domainname.com/cart/ without the www prefix. All worked well.
I then changed my .htaccess file to do a redirect adding www to the front of my domainname. The cart worked ok, but I was not able to log in to the admin section. I kept getting password error and could not log in.

Is there someplace in the code that checks the domain name prefix?

Thanks,

25 Oct 2012, 10:03 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Admin login fails when site url begins with www

Check BOTH of your configure.php files

  define('HTTP_SERVER', 'http://www.your_domain.com');
  define('HTTPS_SERVER', 'https://www.your_domain.com');

  define('HTTP_SERVER', 'http://www.your_domain.com');
  define('HTTPS_SERVER', 'https://www.your_domain.com');
  define('HTTP_CATALOG_SERVER', 'http://www.your_domain.com');
  define('HTTPS_CATALOG_SERVER', 'https://www.your_domain.com');

Zen-Venom Get Bitten

26 Oct 2012, 11:15 PM
#3
kephra avatar

kephra

New Zenner

Join Date:
Sep 2006
Posts:
3
Plugin Contributions:
0

Re: Admin login fails when site url begins with www

Kobra,

Thanks for the tip. It didn't work though. I changed all 6 entries from domainname to www.domainname. When I tried to log in as admin, it still just goes back to the login screen. I don't really get an error, just the same screen over and over. When I remove the www from my URL, admin login works ok. This is very odd.

26 Oct 2012, 11:22 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Admin login fails when site url begins with www

Do you have a htaccess file?
Try renaming it to htaccess.txt and see what response you receive

Zen-Venom Get Bitten

26 Oct 2012, 11:37 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Admin login fails when site url begins with www

Your symptoms appear to be changing.

At first you said you were getting "password error" and then later you said it's just refreshing the page.

If you clear your browser's cache and cookies and remove all .htaccess redirects about "www", what are the new symptoms?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

27 Oct 2012, 8:04 PM
#6
kephra avatar

kephra

New Zenner

Join Date:
Sep 2006
Posts:
3
Plugin Contributions:
0

Re: Admin login fails when site url begins with www

DrByte:

Your symptoms appear to be changing.

At first you said you were getting "password error" and then later you said it's just refreshing the page.

If you clear your browser's cache and cookies and remove all .htaccess redirects about "www", what are the new symptoms?
No, symtoms not changing, just didn't describe it right initially.

I have tried removing my .htaccess file. That did not clear the problem.
I have my browser cache size set to 0. and I did try removing all the cookies associated with the site.
None of these actions fixed the problem.
The problem seemed to be in my apache config files. These are generated by ispconfig, and it now works ok with the .htaccess file and the www. prefix. It was not a problem with zen cart but it sure seemed like.

Thanks for your help.

8 Nov 2012, 6:34 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Admin login fails when site url begins with www

  • SSL certificates are linked to a certain URL (domain name), with or without the www. prefix, which is important
  • your site must use the same domain name as what the SSL certificate is registered to (ie: if www. is in the certificate, then use www. in your site and store)
  • so your configure.php must use the appropriate URL
  • and if it isn't able to start a "session", then it's because the session-start process couldn't set a cookie that matches the domain name you're visiting
  • and if you have pre-existing cookies in your browser and later change the URL in your store, then clearing those cookies is important.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.