0

I'd like to use an extension like .htm in my URLs. Is there a way to accomplish that?

I've defined the following rule:

frontend.route = '/:standort/:id'

When I use the following

frontend.route = '/:standort/:id.htm'

then the name of the variable is id.htm like in $params["id.htm"]. How can I tell the Zend Framework what to use as variables?

Greetings

//Edit

my full config looks like this now:

frontend.type = 'Zend_Controller_Router_Route_Regex'
frontend.route = '/(.?)/(\w+?\.htm)'
frontend.defaults.module = 'frontend'
frontend.defaults.controller = 'index'
frontend.defaults.action = 'index'
frontend.defaults.standort = 'national'
frontend.map.1 = 'standort'
frontend.map.2 = 'id'

this is how I load the config

$file = APPLICATION_PATH . '/modules/' . $module . '/configs/routing.ini';

        if(Zend_Loader::isReadable($file)){
            $config = new Zend_Config_Ini($file);
            $router = Zend_Controller_Front::getInstance()->getRouter();
            $router->addConfig($config);
        }         
tdog4224
  • 138
  • 2
  • 12

1 Answers1

0

You can do this with regex routes:

frontend.type = "Zend_Controller_Router_Route_Regex"
frontend.route = '/(.?)/(\w+?\.htm)'
frontend.map.1 = "standort"
frontend.map.2 = "id"

but unless you're trying to preserve an existing URL structure, I'd just leave the .htm out - it serves no purpose.

Tim Fountain
  • 33,093
  • 5
  • 41
  • 69
  • Thanks, but that does not work. The standard route is used, even though getRoutes() returns the right config and the old one is overwritten. – tdog4224 Dec 11 '12 at 19:18
  • Could you provide more information? When you say 'not accepted', are you getting an error? What does your full config file look like and ho are you loading these routes in? – Tim Fountain Dec 11 '12 at 19:18