Forums / Basic Configuration / Admin URL - Can't Login With Forced WWW vs Non-WWW via .htacces

Admin URL - Can't Login With Forced WWW vs Non-WWW via .htacces

Locked

Views: 2,656

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
28 Feb 2012, 1:34 PM
#1
zywex avatar

zywex

New Zenner

Join Date:
Nov 2011
Posts:
7
Plugin Contributions:
0

Admin URL - Can't Login With Forced WWW vs Non-WWW via .htacces

Hello all,

I couldn't find this on Google or searching through here so here's my post.

I have a freshly installed Zen Cart, everything works fine except for logging into the admin area when I have my site with www forced via the .htaccess file. Once I disable the forced www I can log in and then re-enable it and everything is fine.

It's a work around but I'd prefer not to have to do that.

Thinking that the admin URLs use a forced non-www and are producing a conflict, I added www to the configure.php file within the includes and adminurl/includes directories. That didn't fix it either.

Would anyone have any other thoughts? Any help would be appreciated!

28 Feb 2012, 7:19 PM
#2
drbyte avatar

drbyte

Sensei

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

Re: Admin URL - Can't Login With Forced WWW vs Non-WWW via .htacces

Sounds like your .htaccess rewrite rules are incorrect.

The best place to start is to include the www. in your HTTP_SERVER and HTTPS_SERVER settings in your configure.php files. In that case it's basically unnecessary to do any redirects with .htaccess, because Zen Cart handles the correct URL generation for you the rest of the time, including telling search engines to always look at the www. version only.

.
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.

29 Feb 2012, 3:18 PM
#3
zywex avatar

zywex

New Zenner

Join Date:
Nov 2011
Posts:
7
Plugin Contributions:
0

Re: Admin URL - Can't Login With Forced WWW vs Non-WWW via .htacces

Thanks for the response, normally I'd agree but this case is a little more particular.

Zen Cart is installed in a sub directory off the main site. The main site has been around for about a decade and has a bunch of links that are both www and non-www so forcing www on all http requests ensures everything is uniform for canonical (SEO) purposes.

Unfortunately I already entered the www is in the both of the configure.php files but something in the script is still going to a non-www something or other and can't process the admin login area.

29 Feb 2012, 3:58 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: Admin URL - Can't Login With Forced WWW vs Non-WWW via .htacces

Zen Cart only uses the configure.php information to build its URLs.

So, I respectfully submit that your problem is with the rules in your .htaccess. They must not be correct.

.
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.

29 Feb 2012, 8:07 PM
#5
zywex avatar

zywex

New Zenner

Join Date:
Nov 2011
Posts:
7
Plugin Contributions:
0

Re: Admin URL - Can't Login With Forced WWW vs Non-WWW via .htacces

In fact this was a permissions issue after I looked into it more.

Both configure.php files were not overwriting with the updated files that included the "www." entries. So my earlier statement that I had edited those already was technically incorrect.

I had to change the permissions on them both and was able to upload the edited files without issue.

Now everything works perfectly with the original htaccess.

Thanks!