Laravel prevent Google from indexing admin panel [duplicate]

139
December 01, 2017, at 12:15 PM

This question already has an answer here:

  • Hide a specific folder and it's sub folders and files ? 3 answers

I have a route namespace ('admin') that has a lot of routes. I would like to prevent Google robots to access these routes. But as far as I know,

User-agent: *
Disallow: /

I need to specify actual folders? for example

Disallow: /app

If I am right, then which folders do I need to disallow? Views that belongs to admin panel? Or Controllers? Or maybe something else?

Answer 1

You can use a wildcard to prevent all admin routes from being indexed:

Disallow: /admin/*

https://developers.google.com/search/reference/robots_txt?csw=1

Answer 2

From: https://www.polemicdigital.com/prevent-google-indexing-wordpress-admin-x-robots-tag/

There are two major issues with the robots.txt disallow rule:

  1. Because a website’s robots.txt file is publicly viewable, a disallow rule points hackers to your login folder.
  2. A disallow rule doesn’t actually prevent search engines from showing blocked pages in its search results.

An alternative to ensure your admin folders are secure and cannot be crawled and indexed by search engines is with the use of the X-Robots-Tag. More info here https://developers.google.com/search/reference/robots_meta_tag

Check out Laravel's way of attaching headers to responses at https://laravel.com/docs/5.5/responses to set the header to X-Robots-Tag "noindex, nofollow" for the admin pages.

READ ALSO
PHP logging text from text area with with random class [on hold]

PHP logging text from text area with with random class [on hold]

I am working on a php and chat room and it works by typing in what you want and when you press enter it logs your name that you chose in a tag and after the tag what your message is

113
How add new arrray Row in multidimensional Array PHP

How add new arrray Row in multidimensional Array PHP

I have 2 array I would like add new row in the first with informtion from the secondMy 2 arrray

318
How to move Wordpress admin files to wp-uploads to use as Email attachment?

How to move Wordpress admin files to wp-uploads to use as Email attachment?

I am working with WeForms to create an event registration formThe plugin automatically generates a PDF-File, which can be downloaded in the backend area (under /wp-admin/admin-post

191