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
1 |
<meta name=“robots” content=“noindex” /> |
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. Create well-defined 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 😉
Thanks!
Sanjay Jethva
Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe.
His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.
Prev
How to Show Magento 2 Out of Stock Associated Products in Configurable Products Dropdown
How to Configure Password Options in Magento 2
Next