This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

code200.miha
code200.miha

Hi

What would be best way to add metatag "noindex" to my admin backend area?

Thanks,

inetis
inetis

An alternative solution could be to create a robots.txt to exclude the page.

code200.miha
code200.miha

This is not a good choice since anyone can read robots.txt and see what you dont wish to have indexed. Idea is that I dont want people to find admin login page, not only that admin login page is not displayed in search results.

I managed to set up X-Robots-Tag header in nginx config. I think it will suffice. However I would still love to see what the best way to modify backend code is.

location ~* \.php$ {
                try_files $uri =404;
                fastcgi_intercept_errors on;
                fastcgi_pass unix:/run/php/php-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;

                #prevent robots to index backend 
                if ($request_uri ~* admin(.*)) {
                        add_header  X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
                }
        }

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.