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.

URL Help

June 19, 2011 11:44pm

Subscribe [4]
  • #1 / Jun 19, 2011 11:44pm

    Danny Valle

    21 posts

    I am trying to understand the URL structure in EE2.  I understand the URL structure (http://www.something.com/templateGroup/templateName).

    My question is, why am I able to type in any string after the template group segment or template name and the page still loads? For example, I can type in the following (http://www.something.com/templateGroup/templateName/someRandomText) or (www.something.com/templateGroup/someRandomText) and the page still loads.

    Shouldn’t I get some sort of error??  It’s strange because if a user takes out the template name, the default index page loads without the proper entry_id causing it to load without the information.

    [Mod Edit: Moved to the EE 2 Technical Support forum]

  • #2 / Jun 20, 2011 1:37pm

    John Henry Donovan

    12339 posts

    Hi Danny and welcome to the forums 😊

    EE gives you the flexibility to deal with this yourself and define what you want to happen.

    The first thing you can do is turn on Strict URLs

    What I do myself is use the parameter require_entry=“yes” This parameter tells the channel tag that it should expect the URL to contain a valid entry ID or a valid URL title.

    {exp:channel:entries channel="news" require_entry="yes" limit="1"}
    {if no_results}
    {redirect="404"}
    {/if}
    {/exp:channel:entries}

    Does that help?

  • #3 / Jun 21, 2011 11:01am

    Danny Valle

    21 posts

    Yes, that makes much more sense.  Thank you very much!

  • #4 / Jun 22, 2011 10:41am

    Kyle Cotter

    730 posts

    Hey Danny,

    Glad to see John Henry was able to lend a hand! If you have any more questions, please post again!

    Thanks.

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

ExpressionEngine News!

#eecms, #events, #releases