I have a single entry url like site.com/forum/answers/12272 and would like to have the url_title appended like site.com/forum/answers/12272/how-big-is-a-carp. Anyone got an idea how to do this please? I'm stumped.

Thank you...


4 Answers 4


You can use the {url_title} variable. That is assuming that you are actually using ExpressionEngine channels and not forums.

You don't actually need the entry_id in the url, the url could just be


But if you wanted to keep, the entry_id, you can build the url on the template like:


The process should be similar for forums, but I'd assume the tags/variables maybe different.

  • Thanks for the reply, much appreciated. I should have been clearer, what I'm after is if someone goes to site.com/forum/answers/12272, that site.com/forum/answers/12272/how-big-is-a-carp is rendered. Dec 27, 2012 at 22:28
  • That's the response, I provided. You need to change the template code, for the link. As, I mentioned, it probably reads site.com/forum/answers/{entry_id} and you want it to read site.com/forum/answers/{entry_id}/{url_title} What I don't know is if you are actually using Channels or the Forums Module. The forums module would be different. You can add extra segments after the primary (which in this case is the {entry_id} and still have dynamic addressing. This means you can just place {url_title} after the code that renders the link. Dec 27, 2012 at 22:44

I came up with:

{if segment_4 == ""} {exp:channel:entries limit="1" entry_id="{segment_3}" disable="categories|category_fields|custom_fields|member_data|pagination"} {redirect='forum/answers/{entry_id}/{url_title}'} {/exp:channel:entries} {/if}

  • Unless there are cases where {segment_4} isn't empty, this check wastes resources. On the template that renders the initial url, make the <a href=""> go to forum/answers/{entry_id}/{url_title} that will always place the {url_title} after the {entry_id}, not require an {if} statement and not force a redirect. Dec 27, 2012 at 22:51

Are you saying that what you want is that if the user types one address into their browser bar, a different thing is displayed there after that request is sent to the server?

If you want to actually change the URL that the user sees, then one (not very good) option is to mess around with your .htaccess file to create a rewrite. Another, possibly better option is to use a redirect in your template code, which goes into effect if the extra section of the URI isn't there.

Check out http://ellislab.com/expressionengine/user-guide/development/reference/functions.html#redirect-location-string

I'm afraid that without a more in depth question or example of what you're trying to do it's difficult to understand what you want, exactly... :S


Thanks for the help everyone @nonprofit_tech. I'm using the entries and comment module to build a forum and want the urls of single entry pages formated like site.com/forum/answers/{entry_id}/{url_title}.

I'm intending to use link rel="canonical" href="{path='{segment_1}/{segment_2}/{segment_3}/{segment_4}'}" so that the full url (site.com/forum/answers/{entry_id}/{url_title}) gets indexed by Google. As the entries module is looking at segment_3 to return the entry, it leaves me free to tweak segment_4 for better seo.

I came up with {if segment_4 == ""} {exp:channel:entries limit="1" entry_id="{segment_3}" disable="categories|category_fields|custom_fields|member_data|pagination"} {redirect='forum/answers/{entry_id}/{url_title}'} {/exp:channel:entries} {/if} to guard against segment_4 being missing.

I'm concerned that if Google bot traverses the url it would see the same content at site.com/forum/answers/{entry_id} and site.com/forum/answers/{entry_id}/{url_title}, hence the redirect and the canonical tag

Your Answer

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

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