VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: Jaspers on August 09, 2016, 00:05:37 AM

Title: Virtuemart great problem with 404 pages
Post by: Jaspers on August 09, 2016, 00:05:37 AM
Hello everybody. I just noticed a great problem with virtuemart. If you choose the home page type any of Virtuemart pages and type some nonsense, like site.com/asdasdasdasd - that won't show 404 page. And that problem appears in all virtuemart pages, including products. Аrе there any fixes?
I have checked in all my sites with virtuemart. All sites have the same problem..  :(
Title: Re: Virtuemart great problem with 404 pages
Post by: MagikCommerce on August 09, 2016, 08:41:08 AM
Hello,

           Hopefully you will get help through topic - https://forum.virtuemart.net/index.php?topic=69544.0

Title: Re: Virtuemart great problem with 404 pages
Post by: Jaspers on August 09, 2016, 11:17:45 AM
Greetings. In this topic and all forum there are many ways to get around the problem. No some hacks and fixes. I would like to fix finally this problem.
Title: Re: Virtuemart great problem with 404 pages
Post by: Jaspers on August 09, 2016, 13:09:58 PM
I'm not good at php. Is there a code like "If the url is wrong (not a virtuemart category)" or something similar?
Title: Re: Virtuemart great problem with 404 pages
Post by: GJC Web Design on August 09, 2016, 13:33:58 PM
where do u end up now when there is a non existing page??
Title: Re: Virtuemart great problem with 404 pages
Post by: Jaspers on August 09, 2016, 13:47:39 PM
If i go to somearticle/asdasdasd - that displays an error 404, fage not found.
But when i go to some VM category and type fake url, like :site.com/vmcategory/asdasdasd - that redirects me to site.ru/vmcategory.html.
When i type some fake url like site.com/asdasdasd - that displays the page without some redirects and error - 200 OK, because my home page type is choosed "Virtuemart category". When i choose home page type to some joomla material and type site.com/qweqweqwe - that displays error page 404, as it should.

So i have another question : where i can find the code which is responsible for this redirect to category?
Title: Re: Virtuemart great problem with 404 pages
Post by: GJC Web Design on August 09, 2016, 17:11:56 PM
is this selected?

Enable VirtueMart 404 error handling  ? VM config
Title: Re: Virtuemart great problem with 404 pages
Post by: Jaspers on August 09, 2016, 17:31:54 PM
Yeah, of course. But when i go to components/com_virtuemart/virtuemart.php after  if (VmConfig::get('handle_404',1)) { i write echo "qwerty"; and that does not display "qwerty in category. So i think, that this option in VM is not working.
Title: Re: Virtuemart great problem with 404 pages
Post by: GJC Web Design on August 09, 2016, 19:57:18 PM
just tested

if I uncheck 'Enable VirtueMart 404 error handling' and try a non existent VM page I get a standard Joomla 404

If I check it , sef on, try a none existent product I am redirected to the VM frontpage or if the cat slug is in the url to that cat

if I try a non existent cat page (sef url) I get a std. 404

if I use non SEF urls to non existent cats  I go the VM frontpage

So for me it works

clean J3.6.2/VM3.0.16

trying  print 'Debug Line '.__LINE__.' 404 <pre>'; print_r (VmConfig::get('handle_404')); print "</pre><br />\n"; it does change with the admin change
Title: Re: Virtuemart great problem with 404 pages
Post by: PRO on August 09, 2016, 21:26:12 PM
Quote from: GJC Web Design on August 09, 2016, 19:57:18 PM

if I try a non existent cat page (sef url) I get a std. 404

BUT!   not when any vmart alias is before it

for example. if your shop alias is

/shop


then you type in

/shop/axnlksdlklkfjkldgfj     you will NOT get a 404
what you get is    /shop   display, BECAUSE vmart/ joomla has NO idea what the "view" is supposed to be to even know if its a fake category.

& OP,
This really does not create a SEO problem. The canonical url is in the head of the doc.
Title: Re: Virtuemart great problem with 404 pages
Post by: PRO on August 09, 2016, 21:29:50 PM
Quote from: Jaspers on August 09, 2016, 17:31:54 PM
Yeah, of course. But when i go to components/com_virtuemart/virtuemart.php after  if (VmConfig::get('handle_404',1)) { i write echo "qwerty"; and that does not display "qwerty in category. So i think, that this option in VM is not working.

because you need to change it in
views/category/view.html.php

if (VmConfig::get('handle_404',1)) {
               $app->redirect(JRoute::_('index.php?option=com_virtuemart' . $categoryLink . '&error=404', FALSE));
            } else {
               JError::raise(E_ERROR,'404','Not found');
            }


BUT! this will not work UNLESS joomla knows your in the vmart component
Title: Re: Virtuemart great problem with 404 pages
Post by: PRO on August 09, 2016, 21:35:27 PM
Quote from: Jaspers on August 09, 2016, 13:09:58 PM
I'm not good at php. Is there a code like "If the url is wrong (not a virtuemart category)" or something similar?


yes this can be done ,

BUT! you have to think.

Someone who uses google adwords, and google gives additional tracking parameters, should they 404?
Title: Re: Virtuemart great problem with 404 pages
Post by: Milbo on August 09, 2016, 22:44:47 PM
Quote from: Jaspers on August 09, 2016, 00:05:37 AM
Hello everybody. I just noticed a great problem with virtuemart. If you choose the home page type any of Virtuemart pages and type some nonsense, like site.com/asdasdasdasd - that won't show 404 page. And that problem appears in all virtuemart pages, including products. Аrе there any fixes?
I have checked in all my sites with virtuemart. All sites have the same problem..  :(

This is not an error, there exists unlimited urls for any canonical url. Because when you add something to a valid url, it is just handled as parameter. When the parameter is not used within the view, then the parameter is not without any effect => "unlimited" valid urls and that is not an error, that is by design.
Searchengines handle that completly correct. 404 is actually a code for an not valid link, but our job is to assure that there are no non valid links.
Remind the old times, when you wrote a page with static html, and you used a link to a nonexisting file, for that you have the 404. But in a CMS, you always open the /index.php, which is always valid.

So even our simulation of 404 is nonsense, it should be 303 or so, actually.
Title: Re: Virtuemart great problem with 404 pages
Post by: Jaspers on August 10, 2016, 01:29:50 AM
Thank you very much for replies.
Ok, now i understand, that this is not a problem, and everything works properly.
My default site page is selected virtuemart category page. So when i go to site.com/asdasdasd  -  that does not redirect me to site.com, but there is a canonical link. So i think this would not create a problem with seo.
So lets summarize.
When the default site page is choosed some of VM pages:
When the defaul site page is choosed some joomla standart page, for example some material, than site.com/asdasd will show page 404, but virtuemart pages will work as with defaul vm page.
In spite of unchecked "Enable VirtueMart 404 error handling", the VM will always redirect and does not show the 404 page. I Don't know why, this does not work for me, tried to uncheck this function.Ineffectually.  :) J3.6.0 VM 3.0.16

Also i use a plugin "Canonical links all in one", there is an option: Permanent Redirect to the canonical link. With this option all product pages correctly redirect to canonical link, but "site.com/asdasd" does not redirect to canonical "site.com", i don't know why  :)
Title: Re: Virtuemart great problem with 404 pages
Post by: Milbo on August 10, 2016, 11:07:03 AM
I think we dont have a canonical for "home".
Title: Re: Virtuemart great problem with 404 pages
Post by: vinmax on September 05, 2016, 20:42:38 PM
anybody find the solution?
I have faced the same problem in my virtuemart joomla shop. Please give me suggestion to fix it asap.
Thansk