ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Force title_permalink, disallow permalink results

April 12, 2010 7:21pm

Subscribe [2]
  • #1 / Apr 12, 2010 7:21pm

    judin

    54 posts

    Hello,

    I’m sorry if this is covered elsewhere, but I’ve Googled and searched the forums, etc to no avail.

    Is it possible to force URLs to work only using title_permalink?

    Currently, the following shows the same results:
    /events/243
    /events/event-name-here

    If you lookup the entry by number, I want a 404 page (or the page to redirect to the title_permalink) instead. Is this at all possible?

    Thanks very much in advance,
    Justin

  • #2 / Apr 12, 2010 11:55pm

    Gareth Davies

    491 posts

    404 pages work a bit differently in EE - that is they will only display if the template group doesn’t exist otherwise it’ll display the index page of the template group.

    In your case it’s serving /events/index/

    Few things you can do - one being use the require_entry=“yes” parameter in conjunction with the url_title=“segment_2” - that way only content will be displayed if the url title in the URL. You could use the if no_results conditional to provide output then if not a correct URL title.

    It’s not really clear what you are trying to achieve though and why you would even have the numbers in the URL. Maybe you could post some more code or explain in some more detail if the above doesn’t help.

  • #3 / Apr 13, 2010 6:36pm

    judin

    54 posts

    Hi Gareth,

    Thanks for this - I’ll have a play tomorrow evening and see if this achieves what I want… Otherwise, I’ll be back!

    Regarding the numbers in the URL, this is due to using permalink= rather than title_permalink= to link to single entry pages when creating my listings pages. However, I’ve recently decided to use proper more SEO friendly URLs now.

    Cheers

  • #4 / Apr 15, 2010 4:00pm

    judin

    54 posts

    Gareth,

    Thanks so much for this code - that was exactly what I was after!

    Cheers,
    Justin

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases