Forums / General Questions / Can't Login With Forced WWW vs Non-WWW via .htacces

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

Started by keithz on 30 May 2012, 12:11 PM · Views: 1,731

Results 1 to 8 of 8
30 May 2012, 12:11 PM
#1
keithz avatar

keithz

New Zenner

Join Date:
Mar 2011
Posts:
8
Plugin Contributions:
0

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

I have the same problem as described on this thread - http://www.zen-cart.com/showthread.php?193117-Admin-URL-Can-t-Login-With-Forced-WWW-vs-Non-WWW-via-htacces&highlight=Canonical

The .htaccess file works great both ways to non.www and www. address. After doing this I cannot log into my control panel.

So far I found all the configure.php files I've found have http://www. in front of the domain name. Maybe I am missing some. Can anyone tell me where they are all located?

Thank you

30 May 2012, 12:14 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

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

In a standard install of ZC, there is no htaccess file in the root.

If you have one there, then it is something YOU have added. htaccess files are quite vicious things, as they FORCE certain settings.

ZC handles conanical issues with a link rel command in the html header. There is NO NEED to tinker with htaccess for canonical issues.

20 years a Zencart User

2 Jun 2012, 11:21 AM
#3
keithz avatar

keithz

New Zenner

Join Date:
Mar 2011
Posts:
8
Plugin Contributions:
0

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

Ok. Thank you for the post. It sounds like you are telling me this should not be a problem and I have this problem. What is the best way to fix it? Do I modify the link rel command in the html header? How do I do that and what do I change to fix the issue? Thank you!

2 Jun 2012, 11:39 AM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

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

KeithZ:

Ok. Thank you for the post. It sounds like you are telling me this should not be a problem and I have this problem. What is the best way to fix it? Do I modify the link rel command in the html header? How do I do that and what do I change to fix the issue? Thank you!

What was the reason for putting htaccess in the root install folder for zencart?

Somebody put that file there.

What was the reason for doing so?

It sounds like a lot of "tinkering" has happened. As we have no idea what has been tinkered with we cannot offer advice.

20 years a Zencart User

2 Jun 2012, 12:18 PM
#5
keithz avatar

keithz

New Zenner

Join Date:
Mar 2011
Posts:
8
Plugin Contributions:
0

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

In public_html:

ErrorDocument 403 /404.shtml

ErrorDocument 404 /404.shtml

Header unset ETag
FileETag None

In zc_admin folder:

@copyright Copyright 2003-2010 Zen Cart Development Team

@license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

@version $Id: .htaccess 16111 2010-04-29 22:39:02Z drbyte $

This is used with Apache WebServers

The following blocks direct HTTP requests to all filetypes in this directory recursively, except certain approved exceptions

It also prevents the ability of any scripts to run. No type of script, be it PHP, PERL or whatever, can normally be executed if ExecCGI is disabled.

Will also prevent people from seeing what is in the dir. and any sub-directories

For this to work, you must include either 'All' or at least: 'Limit' and 'Indexes' parameters to the AllowOverride configuration in your apache/conf/httpd.conf file.

Additionally, if you want the added protection offered by the OPTIONS directive below, you'll need to add 'Options' to the AllowOverride list, if 'All' is not specified.

Example:

#<Directory "/usr/local/apache/htdocs">

AllowOverride Limit Options Indexes

#</Directory>
###############################
DirectoryIndex index.php

deny everything

<FilesMatch "...">
Order Allow,Deny
Deny from all
</FilesMatch>

but now allow just certain necessary files:

<FilesMatch "(^$|^favicon.ico$|.*.(php|js|css|jpg|gif|png)$)">
Order Allow,Deny
Allow from all
</FilesMatch>

IndexIgnore /

The following makes adjustments to the SSL protocol for Internet Explorer browsers

<IfModule mod_setenvif.c> <IfDefine SSL> SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 </IfDefine> </IfModule>

Fix certain PHP values

#<IfModule mod_php4.c>

php_value session.use_trans_sid 0

php_value register_globals 1

#</IfModule>

to turn off register_globals

php_value register_globals 0

#turn off X-PHP-Originating-Script header when sending emails from admin
#uncomment to activate:

php_flag mail.add_x_header Off

AuthType Basic
AuthName "zc_admin"
AuthUserFile "/home1/xxxxxxxx/.htpasswds/public_html/zc_admin/passwd"
require valid-user

2 Jun 2012, 3:25 PM
#6
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

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

KeithZ:

AuthType Basic
AuthName "zc_admin"
AuthUserFile "/home1/xxxxxxxx/.htpasswds/public_html/zc_admin/passwd"
require valid-user

With this in place you have a two step login.

The first is performed via your webbrowser using a popup window.
The second is performed via zencart using the login page.

There's nothing wrong with having this additional level of security, as long as you know you have it, and know what the required details are for each. (if both the same then there's no point in using double authentication).

Until you figure out what your problem is you should probably comment out these lines.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

2 Jun 2012, 7:55 PM
#7
keithz avatar

keithz

New Zenner

Join Date:
Mar 2011
Posts:
8
Plugin Contributions:
0

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

Thank you Rod. I removed the text and double log in as you suggested. Still the same result. I am adding this to the .access file in the public_html folder:

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

(changed my domain to my real domain name) It works great. After that when I login to my admin zc_admin my password is rejected and I return to the login - password screen.

3 Jun 2012, 6:14 AM
#8
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

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

RodG:

Until you figure out what your problem is you should probably comment out these lines.

Update on this advice:

Until you figure out what your problem is you should get rid of the .htaccess file you added.

Zencart doesn't need it. Why would you? (if you do need it, you can always add it back after solving the zencart issue)

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.