Closed antitoxic closed 12 years ago
This concerns 1.1/develop
. Strangley the master
seems to have a newer commit which is not applied in the develop
branch: https://github.com/fuel/core/commit/4070ffccbde77ff7837fff8ddc49847ecb3a8ba7
You should not define routes with extensions. Routing happens on URI segments, the extension is irrelevant for a FuelPHP application. That it used to work was considered a bug, that has now been fixed.
As to that commit to master, that looks odd, we'll check that...
Looked at that commit.
It is not newer, it is a 6 month old commit. And two weeks after that commit, Dan rewrote the URI detection logic, in which the detect_uri() method was removed. That's why you don't find it in Input today.
@WanWizard that means the correct version is into the develop branch?
Does this then mean Uri::create
has an error by not appending the detected extenison to the uri.
EDIT: Wait, how can the developer force a route with html? .htaccess ?
The extension is meaningless in FuelPHP, it is only used for REST services.
There is no way to route 'this/that.html' different from 'this/that.jsp'. The extension is irrelevant and ignored. As said, you should not route on extension. The old behaviour will not be restored, as it would break the REST functionality.
@WanWizard Thank you for the clarfification.
What would you recommend in situation where the SEO department requires certain links (articles ,news, certain pages) to have the html extension in the url?
Aside from being irrelevant for SEO purposes, use the 'url_suffix' setting in config/config.php.
@julesjanssen
That will make all urls end with '.html'. I have to make only part of them.
I thought of manually calling Config::set('url_suffix','.html')
in the before()
controller method but that will apply to all of the generated URIs.
You can also use \Uri::create('something/something.html') to add a suffix to just that URL.
Input::uri
always strips out the extension in the uri. This makes a reverese Uri::create and Router to malfunction.If you have a route defined as:
The URI against which the route will be matched is
test
, nottest.html
.Same logic applies to URI::create - it will use the
test
, nottest.html
as base to create a url.