VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Kuubs on May 07, 2021, 09:44:07 AM

Title: noindex nofollow on the cart page
Post by: Kuubs on May 07, 2021, 09:44:07 AM
Hello,

I have a weird issue. I have a Cart menu link, which I set to noindex nofollow, but that meta tag is not inserted into the actual cart page. Anyone has an idea how to do this?
Title: Re: noindex nofollow on the cart page
Post by: sirius on May 07, 2021, 10:06:55 AM
Hi,

you can do it in your .htaccess like so :
(just replace the word "cart" with your own cart link)


## NOINDEX NOFOLLOW
RewriteCond %{REQUEST_URI} (.*)/cart$ [NC]
RewriteRule ^.*$ - [ENV=NOINDNOFO:true]
Header set X-Robots-Tag "noindex, nofollow" env=NOINDNOFO
Title: Re: noindex nofollow on the cart page
Post by: Kuubs on August 04, 2021, 12:27:34 PM
Quote from: sirius on May 07, 2021, 10:06:55 AM
Hi,

you can do it in your .htaccess like so :
(just replace the word "cart" with your own cart link)


## NOINDEX NOFOLLOW
RewriteCond %{REQUEST_URI} (.*)/cart$ [NC]
RewriteRule ^.*$ - [ENV=NOINDNOFO:true]
Header set X-Robots-Tag "noindex, nofollow" env=NOINDNOFO


This doesn't work.
Title: Re: noindex nofollow on the cart page
Post by: Studio 42 on August 04, 2021, 20:25:49 PM
You can add the rule in the robots.txt
Disallow: /cart/
I do not tested it, but most engine should use it
Title: Re: noindex nofollow on the cart page
Post by: Kuubs on August 14, 2021, 13:54:57 PM
Quote from: Studio 42 on August 04, 2021, 20:25:49 PM
You can add the rule in the robots.txt
Disallow: /cart/
I do not tested it, but most engine should use it

This is an option, but it's not great, because Google still indexes it. So the preferred optuon is the meta tag.
Title: Re: noindex nofollow on the cart page
Post by: pinochico on August 17, 2021, 11:21:08 AM

<?php

//SEO
$document JFactory::getDocument();
$document->setMetaData('robots'"noindex, nofollow");
//SEO END

?>

Title: Re: noindex nofollow on the cart page
Post by: Kuubs on August 18, 2021, 09:45:00 AM
Quote from: pinochico on August 17, 2021, 11:21:08 AM

<?php

//SEO
$document JFactory::getDocument();
$document->setMetaData('robots'"noindex, nofollow");
//SEO END

?>



Thanks! This works.
Title: Re: noindex nofollow on the cart page
Post by: Studio 42 on August 18, 2021, 11:58:15 AM
Quote from: Huubs on August 14, 2021, 13:54:57 PM
This is an option, but it's not great, because Google still indexes it. So the preferred optuon is the meta tag.
Google follow the robots.txt but if a page is already indexed, it get not removed directly if you do not remove it in the google console
This is same for meta tag noindex
Title: Re: noindex nofollow on the cart page
Post by: Milbo on August 27, 2021, 23:34:54 PM
Quote from: pinochico on August 17, 2021, 11:21:08 AM

<?php

//SEO
$document JFactory::getDocument();
$document->setMetaData('robots'"noindex, nofollow");



//SEO END

?>



I think that should be part in the core, or not?

Imho we solved that earlier by robots.txt. Provided in the fullinstaller, imho.