Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
use routes.php to redirect filenames to controller?
  • Hey there, keep up the good work!<span class="string"><br><br>For SEO-purposes i would like to declare sth like </span>

        return array(
            'old_file.php' => 'admin/index',
            '_404_' => 'coursearea/404', // The main 404 route
        );

    , so i would like to redirect mydomain.com/old_file.php to my admin controller.

    How is that possible?

    Thanks
    Daniel
  • I keep getting a Server-404...
  • HarroHarro
    Accepted Answer
    You can not route on URI's with extensions unless you enable that in the config. Note that that will have all kinds of side-effects, so I advice against using it.

     It's better to use a rewrite rule for that, much more efficient too.
  • thanks for the quick answer - can you give me a quick example of how and where to do that?
  • In your app/config/config.php:
    /**
     * Routing settings
     */
    'routing' => array(
        /**
         * Whether URI routing is case sensitive or not
         */
        'case_sensitive' => true,

        /**
         *  Whether to strip the extension
         */
        'strip_extension' => true,
    ),

    and set the last one to false.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion