Setting url suffix |
Hi,
in CI3 we could use url_suffix in the config. Where is this option in CI4?
CI4 does not have the option.
By the way, why do you need it?
Thank you.
One solution: https://stackoverflow.com/questions/6202...as-default Or you could customize Router to support url suffix.
See Creating Core System Classes — CodeIgniter 4.2.1 documentation
https://codeigniter4.github.io/CodeIgnit...asses.html
This is a kludge of course (Codeigniter 4 should support this natively in my opinion) but you can do something like this. The regular expression addition strips off any .html extension before continuing on processing the route. This allows requests to work with or without ".html" as the file extension present in the original request.
./system/Router/Router.php Line 173: // Decode URL-encoded string $uri = urldecode($uri); // kludge to work around .html extension on existing links $uri = preg_replace('/(.*)\.html(\?.*)?$/','\1\2',$uri); |
Welcome Guest, Not a member yet? Register Sign In |