I have the Global Redirect and RobotsTxt modules enabled with a multilingual site. Unfortunately this means that www.mysite.com/robots.txt gets redirected to www.mysites.com/en/robots.txt.
While this seems ok in a browser, Google does not follow redirects for robots.txt so it has stopped indexing my site. This seems to have only started recently during an automatic module version update. It seems that something in globalredirect.module is adding a prefix to the robots.txt path.
Is there a way to stop this with the RobotsTxt module? Or do I need to report a bug to Global Redirect to never redirect /robots.txt ?
Comment | File | Size | Author |
---|---|---|---|
#13 | conflict_between_global-2027705-13.patch | 459 bytes | JeroenT |
| |||
#10 | global_redirect-robots_txt-2027705-5.patch | 556 bytes | awm |
| |||
#4 | global_redirect-robots_txt-2027705-4.patch | 518 bytes | Esculap |
Comments
Comment #1
hass CreditAttribution: hass commentedComment #2
Mnilionic CreditAttribution: Mnilionic commentedI still have this problem. Is there a solution?
Comment #4
Esculap CreditAttribution: Esculap commentedComment #5
dewalt CreditAttribution: dewalt commentedThe patch brokes globalredirect module.
It take place, because conditions, listed in #3, are in conflict. Condition
$a != $b || $a != $c
has no sence and always return TRUE, so the solution is the same as:Comment #6
dewalt CreditAttribution: dewalt commentedDisable "Language Path Checking" option, or use domain-based or session-based language detection.
Comment #7
awm CreditAttribution: awm commentedThe Patch above does break the module. I think it should be disabled when the the requeset is to robots.txt and not the opposite. So in other words the if statment should be "==" instead of "!= ' . Patch updated.
Comment #8
awm CreditAttribution: awm commentedComment #9
awm CreditAttribution: awm commentedComment #10
awm CreditAttribution: awm commentedComment #11
dewalt CreditAttribution: dewalt commented@awm, but if the previous check is passed:
so
$_SERVER['SCRIPT_NAME']
is equal toindex.php
, and there is no sense in the patch check. I think the possible solution can be to checkcurrent_path()
for'robots.txt'
Comment #12
awm CreditAttribution: awm commented@dewalt I understand.
Well perhaps this issue is not within the scope of globalredirect. More importantly I don't think this is still true for google.
From google source:
Source:
https://developers.google.com/webmasters/control-crawl-index/docs/robots...
If that's the case I think this issue can be closed as won't fix
Comment #13
JeroenTCreated a new patch.
Comment #14
aesuk CreditAttribution: aesuk commentedI seem to have the same issue here. (7.x-1.6) Im on a multisite setup so we have to use the robots module, and globalredirect is moving the address to https://www.domain.com/en/robots.txt but for us this generates a 404 error. i presume because the robotstxt module does not kick in for the en prefix. But even if it did.
https://developers.google.com/search/reference/robots_txt#file-location-...
@JeroenT Did you have any success with that patch
Comment #15
cmseasy CreditAttribution: cmseasy commented#13 worked for me
Multisite Drupal, multilanguage, php7
Comment #16
aesuk CreditAttribution: aesuk commented#13 worked for me too, thanks JeroenT
Comment #17
Chris Matthews CreditAttribution: Chris Matthews commentedThe 2 year old patch in #13 to globalredirect.module applied cleanly to the latest 7.x-1.x-dev and has two community reviews so taking the liberty to change the status to RTBC.