Forums / General Questions / Strange issue with redirecting from another website

Strange issue with redirecting from another website

Views: 955

Results 1 to 7 of 7
24 May 2013, 6:29 AM
#1
magz avatar

magz

Zen Follower

Join Date:
Apr 2013
Location:
north carolina
Posts:
110
Plugin Contributions:
0

Strange issue with redirecting from another website

Hi,

My store used to reside on another URL as part of a WordPress website (on an Apache server). This week I re-launched it at its new stand-alone Zen Cart location (also Apache) and set up htaccess Redirect 301 on the old website for all of the store pages. Alas, today I noticed that all except home page gave me 404 errors. I was able to fix product and utility pages (contact, shipping, etc.), but all category and subcategory pages are still ending up not being found. (THANK YOU for the sitemap on the "not found" page, by the way!)

On the old website (using an OsCommerce-based plugin for WordPress), category addresses looked like this:

/OLD_SITE/STORE/index/cpath/1/ (or whatever the category ID was)

When categories are accessed by clicking links on the new website, they are found just fine and their URLs look like this:

/NEW_SITE/meaningful-category-name/ (thanks to Ceon URI Mapping)

However, when they're accessed through the redirects from the old website, they are not found and try to look like this:

/NEW_SITE/index/cpath/1/

I set up the htaccess Redirect 301 on the new website to send each /index/cpath/#/ to its corresponding meaningful URL, but although that solution worked for the product and utility pages, it did not work for the category/subcategory pages.

How can I fix this please?

Thank you,
Magz

24 May 2013, 6:54 AM
#2
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Strange issue with redirecting from another website

silly question I know, but have you done URI rewrites for your categories etc?

24 May 2013, 8:41 AM
#3
magz avatar

magz

Zen Follower

Join Date:
Apr 2013
Location:
north carolina
Posts:
110
Plugin Contributions:
0

Re: Strange issue with redirecting from another website

There are no silly questions, picandnix. ;-) I don't know much about rewrites. I'm using Ceon URI Mapping for the SEO friendly URLs, and the plugin does its own rewrites automatically. Each category/subcategory (as well as product and EZ page) has its own friendly URL that way. I'm aware that a rewrite exists to do 301 redirects, but the only way I know how to do them is in this format:
Redirect 301 /old_url/ http://new_url

It's working for products, but not for categories, perhaps because products had friendly URLs on the old website, while categories didn't (which was one of many reasons why I switched to Zen Cart). Still, I don't understand why my redirect instructions are being misinterpreted, I never had this problem with any other website (none of the others used ecommerce, though).

Now...if I were to set up additional rewrites for the categories, how would I do that?

Thanks!
Magz

24 May 2013, 3:16 PM
#4
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Strange issue with redirecting from another website

magz:

...

On the old website (using an OsCommerce-based plugin for WordPress), category addresses looked like this:
/OLD_SITE/STORE/index/cpath/1/ (or whatever the category ID was)

However, when they're accessed through the redirects from the old website, they are not found and try to look like this:
/NEW_SITE/index/cpath/1/

I set up the htaccess Redirect 301 on the new website to send each /index/cpath/#/ to its corresponding meaningful URL, but although that solution worked for the product and utility pages, it did not work for the category/subcategory pages.

...

Redirect 301 /old_url/ http://new_url

It's working for products, but not for categories
...
If your category id's stayed the same during your migration you can add a RewriteRule before the rest of the CEON rules:

RewriteRule ^STORE/index/cpath/([0-9]+)/$ index\.php?main_page=index&cPath=$1&%{QUERY_STRING}

This way CEON URI Mapping will see the URI as being in the original Zen Cart format and should attempt to redirect the old page to the new page. Note: On some hosts you will need to add an extra / to the start of the URL to be matched... "RewriteRule ^/STORE"...

Alternatively you could set the URL of each category in CEON URI Mapping to the old store's URI, then change it back to the new store's URI. This will cause CEON URI Mapping to add the old URI to the "history" and know what the URI is matched it needs to redirect to the new location.

The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

24 May 2013, 7:49 PM
#5
magz avatar

magz

Zen Follower

Join Date:
Apr 2013
Location:
north carolina
Posts:
110
Plugin Contributions:
0

Re: Strange issue with redirecting from another website

lhungil:

If your category id's stayed the same during your migration you can add a RewriteRule before the rest of the CEON rules:

RewriteRule ^STORE/index/cpath/([0-9]+)/$ index.php?main_page=index&cPath=$1&%{QUERY_STRING}

> 
> This way CEON URI Mapping will see the URI as being in the original Zen Cart format and should attempt to redirect the old page to the new page. Note: On some hosts you will need to add an extra / to the start of the URL to be matched... "RewriteRule ^/STORE"...
> 
> Alternatively you could set the URL of each category in CEON URI Mapping to the old store's URI, then change it back to the new store's URI. This will cause CEON URI Mapping to add the old URI to the "history" and know what the URI is matched it needs to redirect to the new location.

Thanks lhungil - Nope, the IDs don't match between the 2 websites. In the latter solution you propose, if an old ID 6 (for example) redirects to new category A, but the new category C now has ID 6, would that cause a problem? (I think it shouldn't as the default URLs are totally different on the 2 websites...) If not, then this would certainly be worth trying.
Thanks,
Magz
25 May 2013, 5:53 PM
#6
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Strange issue with redirecting from another website

magz:

... (I think it shouldn't as the default URLs are totally different on the 2 websites...) If not, then this would certainly be worth trying.
...
I'd say try just changing the URLs twice on a test product - or ask in the CEON URI Mapping thread :)

The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

25 May 2013, 6:28 PM
#7
magz avatar

magz

Zen Follower

Join Date:
Apr 2013
Location:
north carolina
Posts:
110
Plugin Contributions:
0

Re: Strange issue with redirecting from another website

I did test it and it seems to be working fine. Thanks lhungil!