404 Error with spaces in file names and page.media_route_urls: true
Author: complanarCreated Sep 25, 2026Updated Sep 25, 2026
I have just to come back to issue #4197 , as I believe there is another problem with it – in Grav core, I think, so I open this as a new issue.
If you set pages.media_route_urls: true and activate the corresponding rule in .htaccess every file with spaces in it becomes a 404.
Can reproduce with a fresh install of Grav 2.2.1:
- Fresh install
- Add file with at least one space in it, for example
foo bar.pdf. - Add link to markdown as
<foo bar.pdf>
This works as long as page.media_route_urls is set to false or not present in your custom config. If you set it to true as described above the links becomes an error 404.
Source: getgrav/grav