• Resolved Lori Boone

    (@pleazo)


    Hello,

    I am trying to set urls which have “toc” in them to noindex.

    I found this code to use:
    SetEnvIf Request_URI “/toc/“ NOINDEX
    Header set X-Robots-Tag “noindex, follow” env=REDIRECT_NOINDEX

    But I am not sure where to put it. If I put it in header.php, what code do I need before and after this?

    OR

    I also saw this code which I put in my robots.txt, but not sure which method is better. Also the following code sets /toc to noindex BUT /toc/ is still indexed:
    Disallow: /*=toc

    Best,
    Chris

    • This topic was modified 3 years, 4 months ago by Lori Boone.
    • This topic was modified 3 years, 4 months ago by Lori Boone.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support devnihil

    (@devnihil)

    @pleazo If you are wanting to set a page that includes toc in the URL to noindex by using the X-Robots tag, that code would typically be implemented on an Apache server within the .htaccess file for the site. We also have more information on this in the following article: https://yoast.com/x-robots-tag-play/

    If you aren’t familiar with editing the .htaccess file we’d recommend contacting your hosting provider for assistance with this, as it’s quite easy to make mistakes and an error in the .htaccess could easily break your website.

    Thread Starter Lori Boone

    (@pleazo)

    Thanks @devnihil

    Unfortunately, my hosting provider said these codes were breaking my website: https://snipboard.io/LouYxS.jpg :/

    And told me to enter this in my robots.txt instead:
    Disallow: /toc

    But it is not working since https://pleazo.com/shop/pleazo/toc/ is still showing as index. https://snipboard.io/vmO3pR.jpg

    Can anyone help me with setting these dynamic URLs with /toc/ in them to noindex?

    Best,
    Chris

    Plugin Support Md Mazedul Islam Khan

    (@mazedulislamkhan)

    If you want to set noindex to a specific URL using Yoast SEO, you could follow the guide instead here: https://yoast.com/help/how-do-i-noindex-urls/.

    However, if you prefer to use server-specific code to add in the HTTP header, you’ll reach out to your web hosting provider for further assistance on this. They could place the relevant noindex directive directly into the HTTP header response for you.

    Thread Starter Lori Boone

    (@pleazo)

    Thanks for your response @mazedulislamkhan but it does not help my situation. The article does not mention anything about dynamic urls nor the type of page these that includes /toc/. As I mentioned in my original post I want to set urls which have “/toc/” in them to noindex. These are dynamic URLS which I cannot seem to do in the Yoast plugin.

    These urls get generated when a new vendor creates their shop on my online marketplace. Examples of these URLs are:

    /adidas/toc/
    /nike/toc/

    As I also already mentioned in my last post, I did speak to my hosting provider and their suggestion did not work.

    Can someone please help me and let me know how to set dynamic URLS with /toc/ in them to no index?

    Best,
    Chris

    • This reply was modified 3 years, 4 months ago by Lori Boone.
    • This reply was modified 3 years, 4 months ago by Lori Boone.
    Plugin Support Md Mazedul Islam Khan

    (@mazedulislamkhan)

    Thanks for your clarification, @pleazo. In this case, you’ll need to programmatically set noindex to certain pages that has /toc/ within the URL using the wpseo_robots filter. While we are unable to share the exact code snippet, we have listed two pages where you’ll find more information about it:

    We hope this helps!

    Plugin Support devnihil

    (@devnihil)

    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Where to input dynamic noindex URL?’ is closed to new replies.