Zen Cart Logo
Forums / General Questions / .htaccess redirect makes admin login fail

.htaccess redirect makes admin login fail

Locked

Views: 5,029

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
15 Nov 2007, 12:16 AM
#1
jlknauff avatar

jlknauff

New Zenner

Join Date:
Mar 2007
Posts:
30
Plugin Contributions:
0

.htaccess redirect makes admin login fail

We have a .htaccess redirect that redirects from domain.com to www.domain.com. For some reason, this causes us to be unable to log into the admin panel. Any idea why this might happen or how to fix it?

15 Nov 2007, 12:18 AM
#2
sirbuck avatar

sirbuck

Zen Follower

Join Date:
Jan 2007
Location:
Carlsbad, CA
Posts:
161
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

what redirect are you using?

15 Nov 2007, 12:19 AM
#3
sirbuck avatar

sirbuck

Zen Follower

Join Date:
Jan 2007
Location:
Carlsbad, CA
Posts:
161
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

you might try this...

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

Good luck, hope this helps.

15 Nov 2007, 12:20 AM
#4
jlknauff avatar

jlknauff

New Zenner

Join Date:
Mar 2007
Posts:
30
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

Wow, that was quick :D

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

Also, it's on a Linux server running the newest version of Zen.

15 Nov 2007, 12:27 AM
#5
sirbuck avatar

sirbuck

Zen Follower

Join Date:
Jan 2007
Location:
Carlsbad, CA
Posts:
161
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

Cool! I hope that worked out for you. Post the results though so others know if it works.

15 Nov 2007, 12:32 AM
#6
jlknauff avatar

jlknauff

New Zenner

Join Date:
Mar 2007
Posts:
30
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

The redirect works but it still blocks me from logging into the admin.

15 Nov 2007, 5:13 AM
#7
drbyte avatar

drbyte

Sensei

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

Re: .htaccess redirect makes admin login fail

Are you trying to enter your admin using the www. address or without?
Is there any difference if you try each approach?
What exact symptoms are you experiencing when you say "admin login fails"?

15 Nov 2007, 12:48 PM
#8
cjpinder avatar

cjpinder

Totally Zenned

Join Date:
Apr 2007
Location:
Herts. UK
Posts:
893
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

jlknauff:

The redirect works but it still blocks me from logging into the admin.
Check your admin/includes/configure.php file. You might have the non-www version of your domain name in the HTTP_SERVER or HTTPS_SERVER defines. If so, changing it to the www version should fix the problem.

Regards,
Christian.

15 Nov 2007, 2:29 PM
#9
jlknauff avatar

jlknauff

New Zenner

Join Date:
Mar 2007
Posts:
30
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

DrByte:

Are you trying to enter your admin using the www. address or without?
Is there any difference if you try each approach?
What exact symptoms are you experiencing when you say "admin login fails"?

With the www. If I got to it with out the www, it redirects to the www version.

The symptoms are that the screen simply refreshes, but does nothing. The same thing happens if I try to resent the password.

CJPinder:

Check your admin/includes/configure.php file. You might have the non-www version of your domain name in the HTTP_SERVER or HTTPS_SERVER defines. If so, changing it to the www version should fix the problem.

Regards,
Christian.

I checked those and they contain the www.

15 Nov 2007, 2:38 PM
#10
cjpinder avatar

cjpinder

Totally Zenned

Join Date:
Apr 2007
Location:
Herts. UK
Posts:
893
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

jlknauff:

The symptoms are that the screen simply refreshes, but does nothing. The same thing happens if I try to resent the password.

It could be having problems setting the cookie that holds the session id. Try clearing the cookies and cache in your browser.

Regards,
Christian.

15 Nov 2007, 2:49 PM
#11
jlknauff avatar

jlknauff

New Zenner

Join Date:
Mar 2007
Posts:
30
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

Hmmm...that's odd. I cleared everything from FF and now I can access the admin panel in both FF and IE even though I didn't change anything in IE. Well, it works and I guess that's all that matters for now! :laugh:

Thanks guys!

15 Nov 2007, 5:05 PM
#12
sirbuck avatar

sirbuck

Zen Follower

Join Date:
Jan 2007
Location:
Carlsbad, CA
Posts:
161
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

Cool glad it got sorted out. Any ideas as to what it was may be helpful to others if you post.

16 Nov 2007, 9:24 PM
#13
jlknauff avatar

jlknauff

New Zenner

Join Date:
Mar 2007
Posts:
30
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

In hindsight, I think what was going on was that the redirect that I had set up in the .htaccess was somehow conflicting with the Zen admin. Yours worked, but the old one was still cached. When I erased the history/cookies in FF it worked fine, but it was coincidence that IE started working because it was the next day. Since I have IE set to erase history every 24 hours, it would have worked fine if I had tried it first. Anyway, the short answer was that your change to the .htaccess fixed the problem.

6 Feb 2010, 1:24 PM
#14
boardmangraham avatar

boardmangraham

New Zenner

Join Date:
Oct 2009
Posts:
6
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

Hi guys, im having the same problem but this solution hasnt worked for me.

I know for sure its the .htaccess file thats the problem as when I remove the file I can log in admin just fine.

This is the contents of my .htaccess file:

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

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

I have the first one set up to route domain.com to https://www.domain.com and the second one to route http:// to https:// for SSL purposes.

I also know for sure that its something to do with the domain redirect and not the SSL redirect as ive done some testing and the SSL redirect works fine logging into admin.

Any idea what this could be?

16 Sep 2010, 1:22 PM
#15
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: .htaccess redirect makes admin login fail

boardmangraham im not sure if you solved the problem you are talking about but ust for reference for anyone looking for this tread having the sae issue, try doing as suggested but also try to access your admin using the trailing slash too instead of leaving it open, this worked for me after days of searching. so the url would look like this www.yourdomain/admin**/**