Hot answers tagged

5

You can do this without a callback function: $config['resource_router'] = array( 'posts' => 'templates/index', 'posts/:category_url_title' => 'templates/cat_entries', 'posts/:category_url_title/:any' => 'templates/view', );


4

The problem is having no rule and having alpha_dash are exactly the same thing, so the error message is correct, those are duplicate routes. If you added the :pagination rule to the {pagination} variable, then it should work: /about/news/{pagination:pagination} Also, you'll need to have the {pagination:pagination} rule first, since alpha_dash would catch ...


4

I can think of two ways to do this. One is to use Resource Router. Your config would look something like this: $config['resource_router'] = array( ':num' => function($router, $wildcard) { $query = ee()->db->select('url_title') ->where('entry_id', $wildcard->value) ->where('channel_id', 1) // use the right channel id here ...


2

:url_title will match any string that could be a url title as it is converted to ([^/]+) [1] To stop this rule matching template groups, you can check that the match is for a real entry in the expected channel like this: ':url_title' => function($router, $wildcard) { // valid entry in the 'home' channel (id=3)? if ($wildcard->isValidUrlTitle(...


2

With my limited understanding of how your site is configured: I would use the URI structure of url.com/products/cat_group/cat/product_url_title That way you can do this with a single template and control the view from the index.html in the products.group using the Low Seg2Cat plugin with the following if statement: {if segment_3 == "" && segment_2 ...


2

Template Routes Control your URLs by remapping URI routes to a specific template, using CodeIgniter-style routing rules. $config['template_routes'] = array( 'blog/:category' => 'site/blog-category', 'blog/:year/:pagination' => 'site/blog-yearly-archive', 'blog/:any' => 'site/blog-single', );


2

Well, Sean. Now, we have a problem. I already had this discussion with EllisLab, but I believe you should too. Their answer was to use something like: /about/news/{news-post:alpha_dash}/{pagination} And to set required segments to no. This way, the route will match: /about/news/{news-post:alpha_dash}/{pagination} /about/news/{news-post:alpha_dash} /about/...


1

I believe the best is a redirect on the server. It's faster and easier. If the server runs Apache, you can add to the .htaccess file: RewriteRule ^/media/podcast.xml http://domain.com/media/podcast [L,R=302] If everything goes right, replace the 302 by 301.


1

I was just struggling with this problem, everything I was doing was resulting in the same error. I fortunately just managed to fix it though, problem is I'm not 100% sure why it happened I just know that it did. Open up the following file: system > expressionengine > libraries > template_router and open up Route.php Find the following line of code: $hash = ...


1

It's always going to be subjective but I'd go with the simple approach of never having category information in the URL for anything other than a filtered listing page. It's the kind of thing that seems like a good idea at the time, but every decision you make, every new development that happens, every redesign of the site that happens, it will probably come ...


Only top voted, non community-wiki answers of a minimum length are eligible