How to Noindex OneSignal WordPress Plugin Directory?

#21

What will be the benefit of blocking the search result page from crawler,?

0 Likes

#22

To prevent unnecessary crawling, spam links. Ref: labnol

1 Like

#24

@GulshanKumar Is there some issue with this code? It is not adding the “X-Robots-Tag” header. I added using code snippets. Thanks!

0 Likes

#25

Try this method

0 Likes

#26

Thanks for the help!

It is working! I have added the following in my Nginx configuration.

location ~ .*/(?:onesignal-free-web-push-notifications)/.* {
      add_header X-Robots-Tag "noindex, follow" always;  }

Observation:
“X-Robots-Tag” header is not showing for this URL. I believe as we have already blocked the main folder, so that should not be an issue!

https://www.example.com/wp-content/plugins/onesignal-free-web-push-notifications/views/css/icons.css

“X-Robots-Tag” header is showing for following URLs,
https://www.example.com/wp-content/plugins/onesignal-free-web-push-notifications/
https://www.example.com/wp-content/plugins/onesignal-free-web-push-notifications/views/
https://www.example.com/wp-content/plugins/onesignal-free-web-push-notifications/views/css
https://www.example.com/wp-content/plugins/onesignal-free-web-push-notifications/readme.txt

0 Likes

#27

Have you purged cache? (If using any CDN)

0 Likes

#28

Well, I have not integrated any CDN as of now, will be adding it soon. Though, I am using Cloudflare with HTTP Proxy, with the suggestions that Bhanu gave by adding example.com/* with page rule “cache level: bypass”, “disable performance” etc. so that I get an advantage of hiding my cloud VPS IP, DDoS, firewall for blocking visitors IP etc.

Now, the interesting thing is, when I am using http://www.webconfs.com/http-header-check.php , it does not show “X-Robots-Tag” header.

Though in another incognito tab, when I use Developer tools, it shows “X-Robots-Tag” header. LOL! :yum: I think a few hours back, I checked using Developer tools also. “X-Robots-Tag” header was not showing! Though as you mentioned about CDN, I just did “Purge everything” in Cloudflare!

1 Like

#29
$url = "//{$_SERVER['HTTP_HOST']}{$_SERVER["REQUEST_URI"]}";
if (preg_match("#/onesignal-free-web-push-notifications/#", $url))
{
	header( "X-Robots-Tag: noindex, follow", true );
}

can someone tell me where did i paste this code in function.php ? my onesignal plugin pages are indexing in google

0 Likes

#30

In the last.

Or much safer, if you consider using Code Snippet plugin for pasting any such code.

0 Likes

#31

thanks gulshan bhai

0 Likes

#32

Capture
is this correct i paste the code in the last ?
is this code remove my every one signal url from search engines and prevent future indexing or these urls ?

0 Likes

#33

Exactly, true.

0 Likes

#34

The code is not working and I cannot see the No-follow Robots Meta Tags.
@GulshanKumar Requesting your help.

0 Likes

#35

Well, it’s not Meta tag.

It’s x-robots directive for the HTTP header specifically for the OneSignal path.

0 Likes

#36

@GulshanKumar

Hello gulshan, I hope you are doing great.

I am facing the same issues and according to your guide, I have added the code in my function file but still I am not seeing x-robots http header on the my website.

What can be the issue here?

0 Likes

#37

Which hosting are you using?

0 Likes

#38

@GulshanKumar

Royalclouds - litespeed server

0 Likes

#39

Okay, fine. Can you share your site URL? I would like to check once.

0 Likes

#40

@GulshanKumar

I have sent you message.

0 Likes

#41

Solution:

  1. Put a new .htaccess file with below line in the OneSignal plugin directory.
# Noindex everything inside OneSignal Directory
Header set X-Robots-Tag "noindex"
0 Likes