VirtueMart Forum

VirtueMart 2 + 3 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: AlexAkhremenko on April 19, 2012, 20:49:33 pm

Title: VM2 don't show 404 after changing aliases of menu items, but instead redirects.
Post by: AlexAkhremenko on April 19, 2012, 20:49:33 pm
(http://img69.imageshack.us/img69/5586/serenityadministration2.png)


English isn't my native.
I use Joomla 2.5.4 and VM 2.0.6, standart joomla and vm SEF.
See this screenshot.
At first, I maked 4 levels of menu items (all are vm categories such as in virtuemart):

katalog
  vse-dlya-remonta
    dveri
      metallicheskie


And the result was a link of category "metallicheskie": http://serenity.by/katalog/vse-dlya-remonta/dveri/metallicheskie/ (http://serenity.by/katalog/vse-dlya-remonta/dveri/metallicheskie/)

Now I changed second and fourth aliases:

katalog
  stroitelstvo-i-remont
    dveri
      vkhodnye


And received a link: http://serenity.by/katalog/stroitelstvo-i-remont/dveri/vkhodnye (http://serenity.by/katalog/stroitelstvo-i-remont/dveri/vkhodnye)

Using the old link, I should get 404 page, but I turn to page http://serenity.by/katalog/vse-dlya-remonta/dveri/metallicheskie/ (http://serenity.by/katalog/vse-dlya-remonta/dveri/metallicheskie/), that is actually a page http://serenity.by/katalog/ (http://serenity.by/katalog/) (see the title in the source of page!). Google has already indexed that links, and I can't make 301 redirect to new links! And this situation changed with all links! Help me, please!
Title: Re: VM2 don't show 404 after changing aliases of menu items, but instead redirects.
Post by: AlexAkhremenko on April 20, 2012, 17:58:05 pm
I have studied router.fp file and concluded that the function virtuemartparseroute() does not handle non-existent links.
At this block (about line 480):

Code: [Select]
} elseif (!$helper->use_id && ($helper->activeMenu->view == 'category' ) )  {
$vars['virtuemart_category_id'] = $helper->getCategoryId (end($segments) ,$helper->activeMenu->virtuemart_category_id);
$vars['view'] = 'category' ;
}

page just redirects to the link http://serenity.by/katalog/ (in my example), and the segments "vse-dlya-remonta", "dveri" and "metallicheskie" are ignored. But if I check:

Code: [Select]
if ($vars['virtuemart_category_id'] == $helper->activeMenu->virtuemart_category_id) {
JError::raiseError(404, JText::_('JERROR_LAYOUT_PAGE_NOT_FOUND'));
return $vars;
}

I get 404 for non-existent links. This is a rough patch, but so far it works
Title: Re: VM2 don't show 404 after changing aliases of menu items, but instead redirects.
Post by: Milbo on April 22, 2012, 20:28:06 pm
Hmm, did you read the source code of the page, which comes up? When vm2 is not finding a product or category it is going to an upper level, but sending a 404 to google. I am quite sure about this, please recheck.
Besides this, I do not really understand your fix, sry. Keep the good reports :-)
Title: Re: VM2 don't show 404 after changing aliases of menu items, but instead redirects.
Post by: AlexAkhremenko on April 24, 2012, 18:02:08 pm
Hmm, did you read the source code of the page, which comes up? When vm2 is not finding a product or category it is going to an upper level, but sending a 404 to google. I am quite sure about this, please recheck.
Besides this, I do not really understand your fix, sry. Keep the good reports :-)

But Google-bot indexed this pages.

About my fix: now my wm isn't going to an upper level, but just showing standart joomla 404 page.