Simple Module URL

edited May 2016 in Modules
Hi,

I created a simple module with the name "articles", but I want the articles to available through a different url.
In the current state i have to browse to: http://localhost/fuel/articles/testartikel
but I want it to be available via http://localhost/fuel/artikel/testartikel

I tried to modify the MY_fuel_modules.php file by adding this to the module config:


$config['modules']['articles'] = array(
'preview_path' => 'artikel/{slug}',
'module_uri' => 'artikel',
'display_field' => 'title',
'sanitize_input' => array('template','php'),
'pages' => array(
'base_uri' => 'artikel',
),
);

This doens't work. Does anyone know how to accomplish the different URL?

thanks a lot,
Christian

Comments

  • edited 10:39PM
    By default, the routes loaded in the fuel/modules/fuel/config/fuel_routes.php file will expect the module key of "articles" to be used. If it is to be different, you may want to add the following to the main fuel/application/config/routes.php file:
    $route[FUEL_ROUTE.'artikel'] = FUEL_FOLDER.'/module'; $route[FUEL_ROUTE.'artikel/(.*)'] = FUEL_FOLDER.'/module/$1';
  • edited 10:39PM
    Hi,

    thank you for your reply and sorry for the late feedback.
    I added these lines to the routes.php, and they are now available, but somehow I still get the 404 error. Do I need to set some more settings? Sorry for bothering you with that.

    thanks,
    Christian
  • edited 10:39PM
    Hmm... why not change the module name to 'artikel'?
    $config['modules']['artikel'] = array( 'preview_path' => 'artikel/{slug}', 'display_field' => 'title', 'sanitize_input' => array('template','php'), 'pages' => array( 'base_uri' => 'artikel', ), );
Sign In or Register to comment.