Skip to content

Robots.txt is store-view on admin panel, but global on disk #2917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
remkoj-ism opened this issue Jan 7, 2016 · 9 comments
Closed

Robots.txt is store-view on admin panel, but global on disk #2917

remkoj-ism opened this issue Jan 7, 2016 · 9 comments
Labels
bug report Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release

Comments

@remkoj-ism
Copy link

While testing the SEO features of M2, I've identified a second issue, in addition to the bug described at #1146 at least the generated robots.txt is not compatible with a multi-site setup

Steps to reproduce

  1. Setup Magento 2 with two store views, each on their own domain.
  2. Go to the design settings (Stores > Configuration > General > Design)
  3. Ensure that you're in global scope
  4. Under Search Engine Robots load the default robots.txt by pressing "Reset to Default"
  5. Save configuration
  6. Check 1: /robots.txt (should be in /pub when using /pub as web-root, see A few issues when you use /pub as DocumentRoot #1146) contains the just saved configuration.
  7. Switch to one of the store-views
  8. Replace the content in "Edit custom instruction of robots.txt File" with different content
  9. Save configuration
  10. Check 2: /robots.txt (should be in /pub when using /pub as web-root, see A few issues when you use /pub as DocumentRoot #1146) contains the just saved configuration. There's still one file with the content of the store-view, the content of the global scope just got lost.

Suggested solution

I see three options:

  • Make the robots.txt settings global, so they match the implemented logic
  • Hide the robots.txt section in production mode
  • Do not write the robots.txt to disk, but provide a controller which will render the robots.txt based on the configuration and active store-view. Leverage caching by Varnish to prevent M2 from rendering the robots.txt often.
@okorshenko okorshenko added the PS label Mar 8, 2016
@mcspronko
Copy link
Contributor

Hi Magento team,

Any updates regarding this issue?

Thanks,
Max

@hostep
Copy link
Contributor

hostep commented Jun 7, 2016

I really like option 3 of @remkoj-ism's suggestions

It would allow extension developers / integrators to also add logic to add contents to the robots.txt file.

For example: I'm thinking about 3rd party layered navigation modules, which can sometimes add a whole bunch of query parameters to the product listing url's depending on how you filter/sort/search for products. In most of the cases, you don't want a search engine to index all those different combination of filters/sorting/search params.

If those extensions were able to manipulate the contents of the robots.txt through some kind of API, they could dynamically add custom rules to the robots.txt about certain query parameters which should be ignored by search engines.

Even Magento 2's stock layered navigation can benefit from this I believe.

The key to this is caching, we don't want every request to run a whole bunch of queries against the database to built this file obviously.

This is just a wild idea, might turn out to actually be a bad idea, I haven't really thought it through a lot :)

@duhon duhon self-assigned this Jun 22, 2016
@duhon
Copy link
Contributor

duhon commented Jun 22, 2016

Hello @remkoj-ism

Please, provide the used version. If the problem is actual for a specific tag, please, specify it and be sure that the latest update was used.

@mcspronko
Copy link
Contributor

mcspronko commented Jun 22, 2016

Hi Andrii ( @duhon ),

This issue exists for all Magento 2.x versions.
Please have a look into \Magento\Config\Model\Config\Backend\Admin\Robots class
$this->_directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);

Hope it helps to resolve the issue faster since it is a blocker for all production websites.

Thanks

@mcspronko
Copy link
Contributor

Any progress on this issue? At least internal ticket number :).
Thanks

@mcspronko
Copy link
Contributor

Any updates regarding this issue? It affects all websites and its SEO/Marketing goals.

@hostep
Copy link
Contributor

hostep commented Jul 15, 2016

@mcspronko, over at #1146 they mention MAGETWO-47607, so I guess this ticket also gets tracked in that issue.

@pboisvert
Copy link

yes--Piotr expanded the scope of 47607 to include robots.txt in addition to sitemap

@vkorotun vkorotun removed the PS label Aug 4, 2016
@duhon duhon removed their assignment Aug 17, 2016
@veloraven veloraven added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report labels Aug 18, 2016
@vkorotun vkorotun added linked and removed linked labels Aug 19, 2016
@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed SEO labels Sep 11, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Oct 20, 2017
@magento-engcom-team
Copy link
Contributor

@remkoj-ism, thank you for your report.
The issue is already fixed in develop branch, 2.2.0

@magento-engcom-team magento-engcom-team added 2.1.x Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release labels Oct 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release
Projects
None yet
Development

No branches or pull requests

9 participants