Skip to content

Commit

Permalink
fix robots url (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebakernz authored Oct 21, 2024
1 parent 36ee637 commit d6e3ad2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Controller/RobotsTxtController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,15 @@ public function index(HTTPRequest $request)
'Host' => Director::absoluteBaseUrl()
])->renderWith('RobotsTxtDisallowAll');
}

// Check base URL for trailing slash, add so filepath for robots.txt is correct
$baseURL = Director::absoluteBaseUrl();
if(strrev($baseURL)[0] != '/') {
$baseURL .= '/';
}

return $this->customise([
'Host' => Director::absoluteBaseUrl()
'Host' => $baseURL
])->renderWith('RobotsTxt');
}
}

0 comments on commit d6e3ad2

Please sign in to comment.