<?php return [ '_root_' => 'calculator/index', // The default route '_404_' => 'static/404', // The main 404 route // Static pages 'about' => 'static/about', 'links' => 'static/links', ];Going to [url=http://mysite/about]http://mysite/about[/url] works, but so does [url=http://mysite/about]http://mysite/about[/url].stuff. I tried this rule and noticed the same thing:
'^about$' => 'static/about',
class BaseController extends Controller { function before() { if (strlen(Input::extension())) { Response::redirect(Input::uri(), 'location', 301); // maybe this works? } } }
I ended up doing something very similar:alexrussell wrote on Tuesday 8th of May 2012:I don't really know what I'm talking about here, but I would suggest having all your controllers extending a common app controller (thinking like CakePHP, dunno if Fuel does the same or not, I'm very new) and then using the before() method on the base controller look at Input::extension(). Not sure how easy it is to get the current page using FuelPHP though (Input::uri() looks like a good candidate form the docs, let's assume it drops the extension too). It'd be nice if you could do something like:
class BaseController extends Controller { function before() { if (strlen(Input::extension())) { Response::redirect(Input::uri(), 'location', 301); // maybe this works? } } }
public function before() { // Redirect from old URLs (.php) and any others with an extension - These pages don't need one if (Input::extension() !== null) { Response::redirect(Input::uri(), 'location', 301); } parent::before(); }
It looks like you're new here. If you want to get involved, click one of these buttons!