If this is your first visit, check our documentation. To post, register or login.
Forums / Basic Configuration / Cant login to admin after 301 redirect htaccess

Cant login to admin after 301 redirect htaccess

Locked

Started by drunkguy on 16 Aug 2009, 8:04 PM · Views: 6,348

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
16 Aug 2009, 8:04 PM
#1
drunkguy avatar

drunkguy

New Zenner

Join Date:
May 2009
Location:
Longmont, CO
Posts:
91
Plugin Contributions:
0

Cant login to admin after 301 redirect htaccess

Cant login to admin after 301 redirect htaccess.

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^angiejolee.com
RewriteRule ^(.*)$ http://www.angiejolee.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !^/?store
RewriteCond %{REQUEST_URI} !^/?gallery2
RewriteCond %{REQUEST_URI} !^/?gallery3
RewriteCond %{REQUEST_URI} !^/?gallery4
RewriteCond %{REQUEST_URI} !^/?gallery5
RewriteRule ^(.+)?$ /store/ [QSA,R=301]

Someone suggested in another thread adding www. to the domain in admin/configure.php but that didnt work, in fact with this change, I could not login even without the above redirect.

Anybody know how to fix this popular topic?
Thanks
Drunkguy

18 Aug 2009, 6:15 PM
#2
pochat avatar

pochat

New Zenner

Join Date:
Aug 2009
Posts:
1
Plugin Contributions:
0

Re: Cant login to admin after 301 redirect htaccess

I'm having the same issue. I can't access admin once this redirection happens.

Any help?

20 Aug 2009, 8:08 PM
#3
drunkguy avatar

drunkguy

New Zenner

Join Date:
May 2009
Location:
Longmont, CO
Posts:
91
Plugin Contributions:
0

Re: Cant login to admin after 301 redirect htaccess

If your htaccess file looks like this, rewriting urls to www. then:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R=301]

Look at your configure.php file in admin/includes and add "www." in front of the domain name. That alone might fix admin login.

I also did the same thing to configure.php file in /includes just to be safe.

Lastly, I made sure I was not following a bookmark to the login php file that might have a cookie set with session data or something.

Thats what fixed it for me.

13 Jan 2010, 10:24 PM
#4
ptowers49 avatar

ptowers49

New Zenner

Join Date:
Aug 2009
Location:
UK
Posts:
71
Plugin Contributions:
0

Re: Cant login to admin after 301 redirect htaccess

I have the same problen logging into admin after putting in the 301 redirect from non-www to www.

Code added to htaccess:-

RewriteCond %{HTTP_HOST} !^www.saving-light-bulbs.co.uk$
RewriteRule (.*) http://www.saving-light-bulbs.co.uk/$1 [R=301,L]

I have in the config file
define('HTTP_SERVER', 'http://www.saving-light-bulbs.co.uk');
define('HTTPS_SERVER', 'https://pegasus.terrassl.net/~saving');

and in admin config
define('HTTP_SERVER', 'https://pegasus.terrassl.net/~saving');
define('HTTPS_SERVER', 'https://pegasus.terrassl.net/~saving');
define('HTTP_CATALOG_SERVER', 'https://pegasus.terrassl.net/~saving');
define('HTTPS_CATALOG_SERVER', 'https://pegasus.terrassl.net/~saving');

Does this look ok?
Any ideas?

13 Jan 2010, 11:00 PM
#5
mhel avatar

mhel

New Zenner

Join Date:
Dec 2009
Posts:
7
Plugin Contributions:
0

Re: Cant login to admin after 301 redirect htaccess

Try this:
add this to .htaccess in admin/

RewriteEngine Off

Warning: do it at your own risk, I actually don't know yet the downside of the mods.

this fixes mine, hopefully yours too.

14 Jan 2010, 8:36 PM
#6
ptowers49 avatar

ptowers49

New Zenner

Join Date:
Aug 2009
Location:
UK
Posts:
71
Plugin Contributions:
0

Re: Cant login to admin after 301 redirect htaccess

I tried
RewriteEngine Off
in the admin htaccess and it solved the problem of getting into admin BUT admin, checkout and login were no longer directed to SSL!!!!
any other ideas?

15 Jan 2010, 10:07 AM
#7
ptowers49 avatar

ptowers49

New Zenner

Join Date:
Aug 2009
Location:
UK
Posts:
71
Plugin Contributions:
0

Re: Cant login to admin after 301 redirect htaccess

I've fixed this now by using slightly different rewrite code in the htaccess file

I used :
RewriteCond %{HTTP_HOST} ^saving-light-bulbs.co.uk [NC]
RewriteRule ^(.*)$ http://www.saving-light-bulbs.co.uk/$1 [L,R=301]

for the site : https://www.saving-light-bulbs.co.uk

I found the information here http://www.seobook.com/archives/001714.shtml

15 Jan 2010, 10:54 AM
#8
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Cant login to admin after 301 redirect htaccess

To prevent confusion for those reading this thread at a later date, the following is what one can use for adding or removing the 'www' in the URL.

Make sure to change 'yourdomain.com' to your Domain name.

You can only use one or the other, do not use both.

RewriteEngine ON

removes www from Browser URL

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

or...

RewriteEngine ON

adds www to Browser URL

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

Copy & paste whichever you prefer and put the code at the top of your .htaccess file, for easy reference.

Also, always make sure to immediately test any changes to your .htaccess file. If something within it is incorrect your site will not be accessible.

The learning is in the doing.

Potent Products

27 Apr 2011, 7:39 AM
#9
dragonbro avatar

dragonbro

New Zenner

Join Date:
Apr 2011
Posts:
6
Plugin Contributions:
0

Re: Cant login to admin after 301 redirect htaccess

mhel:

Try this:
add this to .htaccess in admin/

RewriteEngine Off

> 
> Warning: do it at your own risk, I actually don't know yet the downside of the mods.
> 
> this fixes mine, hopefully yours too.

This resolution works for my site: [Custom Auto Accessories](http://www.auto-acc.info). 

BTW, based on my opration, modifying the 2 configure.php can't fix the problem, I don't know how the guy who claims it do.