Removing .php landing pages from Google Search Console using Yoast Robot.txt
-
Hi,
Our website was recently injected with malware which has now been removed by reinstalling WordPress. But in Google Search Console, I’m still seeing the pages/urls that were injected in the site with server error 5xx. These URLs are ending with .PHP (from wp-includes folder) files that are redirected to another site.
I was wondering if it’s okay to add Disallow: wp-includes command in the Robots.txt file.
Would this solve this server error for these files? I’ve also watch this video guide in which it says to add .htaccess file to wp-includes that will not allow google to crawl PHP, js, or css files within that folder.
Video: https://www.youtube.com/watch?v=IP0yGFwoq1s
Here’s the code that I would add in the .htaccess file:
<FilesMatch "\.(php)$"> #deny from all #Header set X-Robots-Tag "noindex" Header set X-Robots-Tag "noindex" </FilesMatch>
This file would then be in wp-includes folder.
- The topic ‘Removing .php landing pages from Google Search Console using Yoast Robot.txt’ is closed to new replies.