News:

Looking for documentation? Take a look on our wiki

Main Menu

noindex nofollow on the cart page

Started by Kuubs, May 07, 2021, 09:44:07 AM

Previous topic - Next topic

Kuubs

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?

sirius

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
J3.10.12 | PHP 7.4.33 + APC + Opcode
VM Prod : 3.8.6 | VM Test : 4.4.0.11095

Kuubs

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.

Studio 42

You can add the rule in the robots.txt
Disallow: /cart/
I do not tested it, but most engine should use it

Kuubs

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.

pinochico


<?php

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

?>

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Kuubs

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.

Studio 42

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

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/