Zen Cart Logo
Forums / General Questions / 301 Solution? My 301 redirect blocks me from logging into my admin

301 Solution? My 301 redirect blocks me from logging into my admin

Locked

Views: 3,537

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
25 Jun 2008, 3:52 PM
#1
qwert302 avatar

qwert302

Zen Follower

Join Date:
Mar 2008
Posts:
148
Plugin Contributions:
0

301 Solution? My 301 redirect blocks me from logging into my admin

So if I 301 all of my non-www pages to www then my admin stops working. I've tried to find ways around this and messed with both my configuration files and can't seem to get the admin to let me log-in when my 301 redirect is active.

Does anyone have a solution to this? Or perhaps an easy way to redirect just my non-www index page to the www page (just the homepage, as this will be where the majority of my links would be anyway).

Right now I'm just renaming my .htaccess when I need to get in the admin, and then change it back for SEO when I'm not using the admin.

Thanks.

25 Jun 2008, 7:55 PM
#2
website_rob avatar

website_rob

Inactive

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

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

If you are referring to pages for Zen Cart, by including 'www' within your Domain name for both config files it will redirect automatically.

25 Jun 2008, 8:48 PM
#3
qwert302 avatar

qwert302

Zen Follower

Join Date:
Mar 2008
Posts:
148
Plugin Contributions:
0

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

It should, but for some reason it doesn't. If you click on any of my links they include the www, but if you type in rothsound.com you get rothsound.com, not https://www.rothsound.com.

I'm not sure if it's because I'm hosted on Godaddy, since that is usually the answer to why my website isn't behaving.

25 Jun 2008, 8:52 PM
#4
qwert302 avatar

qwert302

Zen Follower

Join Date:
Mar 2008
Posts:
148
Plugin Contributions:
0

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

Your website is the same way as mine, if you type in https://www.potentproducts.com you get https://www.potentproducts.com, and if you type in potentproducts.com you get potentproducts.com.

What I desire is a 301 redirect so that it is always the www. version. This is supposedly way better for search engine rankings.

25 Jun 2008, 9:17 PM
#5
website_rob avatar

website_rob

Inactive

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

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

Qwert302:

It should, but for some reason it doesn't. If you click on any of my links they include the www, but if you type in rothsound.com you get rothsound.com, not https://www.rothsound.com.

I'm not sure if it's because I'm hosted on Godaddy, since that is usually the answer to why my website isn't behaving.
Not using 'www' will only happen for the first page and/or if someone manually types your Domain name in their Browser. Every Zen Cart page after that will use 'www', even SE bots.

Using 'www' is actually using a Sub-domain. When registering a Domain name for example, you do not include 'www' because in actuality, 'www' is not part of a Domain name.

Not sure why the importance of using 'www' as it is no longer used much nor desired. If you tell someone your URL address / Domain name, do you included the 'www' or no? All Web site should work without the 'www' anyway.

26 Jun 2008, 12:39 AM
#6
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,289
Plugin Contributions:
39

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

It matters not which you use.... However, every website should have only one canonical url www or non www.

The purpose of 301 redirecting one to the other is so all all PageRank, backlinks, indexing is in fact for the same canonical version and prevent duplication.

If you have backlinks for example to your non-www domain url and backlinks to the www url the search engines will credit them as separate web pages and thus you can split your PageRank. A proper 301 will transfer the backlinks to the proper canonical url after 30 to 90 days.

It should be noted that your index.php can split links and PageRank as well and it should be redirected with a 301 to your canonical choice of domain url.

When Google for example goes to http://www.pretendsite.com and http://pretendsite.com they think they are 2 different pages... But see them as duplicate content. When Google finds duplicate content they make the decision to index one or the other in the main search results and the other version is omitted from the main index results.... Of course initially this is not such a big deal IF Google chooses correctly, however this about the larger scale.... Once your site gets over a magical percentage of duplicate content of any kind your index score goes down, Google crawls less for these "duplicate pages" and your entire site's ability to rank is dampened by the effect of the large scale duplication.

So to answer the question... If you are rewriting with the redirect you can simply turn of the rewrite engine off in the first line of your Admin folder's htaccess..

RewriteEngine off

That essentially cancels all rewrites before initializing the admin interface and then refers to any in the admin folders from a clean slate.

~Melanie Prough

26 Jun 2008, 1:36 PM
#7
qwert302 avatar

qwert302

Zen Follower

Join Date:
Mar 2008
Posts:
148
Plugin Contributions:
0

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

mprough that is amazing! Thank you ever so much. I don't think enough people are doing this, and the ones that are run into the admin problem, but you have solved the hell out that problem.

It makes perfect sense to just turn off the rewrites for the admin, I didn't know you could do that.

Sweetness.

26 Jun 2008, 2:08 PM
#8
qwert302 avatar

qwert302

Zen Follower

Join Date:
Mar 2008
Posts:
148
Plugin Contributions:
0

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

So to recap, in order to 301 non-www to www but still be able to use the admin I added these lines to the .htaccess in my root folder, specifiying my actual domain.

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] 

and added this to the top of my .htaccess in your admin

RewriteEngine off

I hope this will increase my PR and rankings.

26 Jun 2008, 2:55 PM
#9
qwert302 avatar

qwert302

Zen Follower

Join Date:
Mar 2008
Posts:
148
Plugin Contributions:
0

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

mprough:

It should be noted that your index.php can split links and PageRank as well and it should be redirected with a 301 to your canonical choice of domain url.

~Melanie Prough

Hmm, whenever I try to rewrite index.php to / I get a loop and the page won't load.

redirect 301 /index.php http://www.rothsound.com/

What should I do?

27 Jun 2008, 1:46 PM
#10
qwert302 avatar

qwert302

Zen Follower

Join Date:
Mar 2008
Posts:
148
Plugin Contributions:
0

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

Ok, I now officially only have one homepage instead of 4! This is what I've put in my .htaccess in the root

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.example.com/$1 [R=301,L]

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

and the code on my previous post in my .htaccess in the admin.

Thanks for all the help

28 Jun 2008, 9:52 PM
#11
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,289
Plugin Contributions:
39

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

Way to go, you are very welcome!

Cheers,
Melanie

2 Jul 2008, 1:57 AM
#12
qwert302 avatar

qwert302

Zen Follower

Join Date:
Mar 2008
Posts:
148
Plugin Contributions:
0

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

Just discovered the index.php redirect prevents you from adding stuff to your cart! I thought I tested that before, but apparently not! Whoopsie.

Anyway, so now I'm looking for another solution to the index.php duplicate issue.

2 Jul 2008, 11:00 AM
#13
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,289
Plugin Contributions:
39

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

Hi,
A redirect for your index.php should not cause any issues at all.... Just in case you didn't use the correct syntax it is below.

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php?\ HTTP/
RewriteRule ^(.*)index\.php?$ http://www.website.com/$1 [R=301,L]

~Melanie

2 Jul 2008, 2:22 PM
#14
qwert302 avatar

qwert302

Zen Follower

Join Date:
Mar 2008
Posts:
148
Plugin Contributions:
0

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

You save the day again! The syntax I was using was redirecting anything that had an index.php to the non-index.php version

example: /index.php?main_pageXXXX was going to /?main_pageXXXX

And that works for everything except the cart, but your syntax is much better, more specific. Thanks again!

OK, here is the recap for anyone looking to fix this issue for their own store. Put this in your .htaccess in your root folder.

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php?\ HTTP/
RewriteRule ^(.*)index\.php?$ http://www.website.com/$1 [R=301,L]

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

and this in your admin .htaccess

RewriteEngine Off

I'm really looking forward to the Simple SEO contribution, which will hopefully incorporate everything I've tried to do here. It looks good, but apparently it doesn't sync with Paypal, which scares me off.

2 Jul 2008, 2:40 PM
#15
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,289
Plugin Contributions:
39

Re: 301 Solution? My 301 redirect blocks me from logging into my admin

Great, glad you have it solved =-)

~Melanie