Use Search, click on the link and move to correct page or section
Using search on index page, clicking on a link generates a 404 not found
(problem with relative paths)
1.https://demo.phpdoc.org/3.0/default/
Same here. All search results are 404 on https://phpcsutils.com/
Eg: search for "tab" and then click a result. You'll be directed to a page like this: https://phpcsutils.com/classes/PHPCSUtils-TestUtils-UtilityMethodTestCase.html#property_tabWidth which does not exist.
@jaapio I can confirm this issue. Just got reported to me as well for the PHPCSUtils website, though it seems to be context related.
What fails:
What works:
Done some more testing and looks like it's only when on the homepage that the search result links don't display resolve correctly, though no guarantees.
It would seem that the generated URLs always assume you are in a subdirectory; while this is not the case on the homepage. Let's see why that is :)
The problem is that the URLs for the search are generated on compile time; but URLs should be relative to the current folder. Because the search index is generated into a subfolder; the URLs will always assume they are 1 nesting level deep.
I am now doing an experiment with using the <base> tag and changing the way we render URLs as this is a common problem and I hope that by using the <base> tag I can prevent future issues in other parts of the codebase too
A fix is ready in the attached PR; when the build is green I can merge it
Sparkly! :sparkles:
Most helpful comment
Same here. All search results are 404 on https://phpcsutils.com/
Eg: search for "tab" and then click a result. You'll be directed to a page like this: https://phpcsutils.com/classes/PHPCSUtils-TestUtils-UtilityMethodTestCase.html#property_tabWidth which does not exist.