How to Prevent Google From Indexing Magento 2 Admin URL

Google has employed its web crawlers to crawl and index the web pages in order to make it visible in search. However thankful we are for that, we don’t want Google’s bots to index certain pages of our Magento 2 store like admin URL, staging sites, or admin login page! The reasons may be either privacy, security or the pages are yet under development, but for implementing particular features, you had to connect it to the web!

Also, in the efforts to hide such pages from search engines like Google, we do not want it to affect the store’s overall SEO too! Fortunately, search engines allow store owners to restrict which pages not to index!

For instance, to prevent Google from indexing Magento 2 admin URL, follow the simple method given below:

Method to Prevent Google From Indexing Magento 2 Admin URL:

Add the below code in app/design/adminhtml/default/default/template/page/head.php file

To hide the Magento 2 admin login page from Google, add the similar code in app/design/adminhtml/default/default/template/login.phtml

Easy and quick!

There’s another method to hide Magento 2 pages from Google using the robots.txt file. Learn more about robots.txt and the second method at How to Configure Robots.txt and Meta Robots for Magento 2

If you still find any difficulty in preventing search engines to index your pages that are meant to be private, ask for help in the Comments section below! I’ll help to keep Google at bay 😉



(based on 13 Reviews)
How to Prevent Google From Indexing Magento 2 Admin URLAuthor Magento Badge

Sanjay Jethva

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

Leave a Reply

Your email address will not be published.