2

I've read all of the eecms documentation on Template Routes Manager to no avail. I don't see any simple tutorial on how to use template route manager to remove index.php or template_group name.

Is there an easy example of how to do this?

This user guide is garbage: http://ellislab.com/expressionengine/user-guide/urls/template_routes.html

I've read it three times and somehow know less about template routes manager than I did before.

I've asked this question multiple times before with crazy suggestions. Suggestions that aren't scalable or user friendly.

Any takers? Not looking to use anyone as a crutch... If there's an awesome article you've read on this, you can share that! Anything, as long as it makes sense!

As well, I don't want to use Structure. It has caused many of my sites to crash over the past few years.

1
  • Many thanks for taking the time to reply it's much appreciated! I tried your suggestion of adding the news/{article} and selected 'yes' for segment required (if I select 'no' for segment required it breaks the front-end altogether), and then changed the link to the article entires to just news/ (instead of news/article) and it works! Thanks again user3384!
    – MGX
    Jul 22, 2014 at 9:21

3 Answers 3

5

You can not use Template Routes to remove index.php from your URLs. To remove index.php from you URLs you need to set up a redirect in an htaccess file, there are instructions here.

Getting rid of the group name is where Template Routes comes in. Navigate to the Template Route Manager under Design ‣ Templates ‣ Template Route Manager. Locate the Route field for the Template you wish to change the URL for. In the Route field put the new URL you wish to access your template by and then click Update. For the simplest case of a static URL you would use something like:

/my-new-url

And now you should be able to access that template by going to

www.yoursite.com/my-new-url

Here is a blog post I wrote that walks through a couple examples of more complex Template Routes.

If you don't mind me asking, what did you find confusing about the documentation? We're always looking to improve our documentation, so if you have any suggestions we definitely want to hear them.

2
  • Little late to comment maybe, but to improve docs more examples would be helpful for the template routes section. Jul 2, 2014 at 16:15
  • Struggling with this as your blog post doesn't have an example that matches would I'd like to do, which is change: www.example.com/news/article/todays-news-update to: www.example.com/news/todays-news-update i.e. removing 'article' from the URL ('article' being the template name) Is anyone able to provide simple instructions for how to achieve this using Template Routes? Thanks for your help!
    – MGX
    Jul 21, 2014 at 15:59
0

I agree the routing documentation truly is pretty terrible. No clear examples to even get a person started.

I just had a similar situation to yours that I just resolved. I have a product listing page and then an individual product page. My template group is products/index for the listing page, and products/view for the individual product page. So to view a product the default url would have been products/view/[product_name], but I wanted it to be products/[product_name].

In my Template Route Manager, I added this rule next to my products/view template: products/{product} and selected 'yes' for segment required.

That means that if the {product} variable is not in the url, that rule is not used and my products/index template takes over.

For some reason EE doesn't like certain variable names (the {product} part) in the template routing manager and will throw errors on the front end. I found this through experimentation, so I don't know what the deal is there.

Hope that helps.

0

Removing index.php from the URL can be done in the .htaccess file. This technique has worked for me on several occasions. See Ellislab's information page. https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.