Skip to content
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

Reduce redundant disallow rules in robots.txt #24

Open
CMSworker opened this issue Dec 12, 2024 · 0 comments
Open

Reduce redundant disallow rules in robots.txt #24

CMSworker opened this issue Dec 12, 2024 · 0 comments

Comments

@CMSworker
Copy link

CMSworker commented Dec 12, 2024

I thought this problem was specific to the Contao CMS, which uses this package to generate the robotos.txt, but I was asked to report it here instead so that everyone using it can benefit from a fix. (Related Contao Issue#7742 and rejected Contao PR#7743)

I'm not quite sure how to explain it in a general way but maybe like this:

When there is a record with only the directive disallow:/ (just this one line) and, for example, another EventListener adds other disallow directives (or vice versa), it ends up with redundant disallow rules in the robots.txt, for example like

User-agent: AnyFancyBotName
disallow:/
disallow:/somefolder/
disallow:/anotherfolder/

The additional disallow rules are not necessary, as disallow:/ already prohibits access to them. So ideally this package should check if there is a general disallow:/ directive and if so, remove other disallow: rules from this record when the robots.txt gets rendered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant