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.

Dealing with Invalid URLs

August 05, 2010 4:24pm

Subscribe [3]
  • #1 / Aug 05, 2010 4:24pm

    grovberg

    50 posts

    I’ve got what I assume to be a pretty standard setup for our site.

    Home Page
      Section 1
          Page A
          Page B
          Page C
      Section 2
          Page D
          Page E
          Page F

    I’ve created a weblog and template group for each Section. Each template group has a single template (index). To add a page to the section, you add an entry to that section’s weblog. So my URLs are something like http://domain.com/index.php/section_1/page_d/ which would show the page_d entry using the section_1 template. Good so far.

    This doesn’t cover when someone goes to http://domain.com/index.php/section_1/ though, so I handled that by setting up an {if} that looks to see if segment_2 is blank, and if it is, deliver a pre-selected article. That works fine, but only if segment_2 is blank. As soon as someone makes a typo in the URL, or tries to go to a page that doesn’t exist, what gets displayed is a frankenstein amalgamation of the contents of EVERY entry in that weblog.

    Personally, I’d prefer that EE deliver a 404-style error when someone enters an invalid URL, but at the very least, I’d like to prevent them from seeing this frankenstein page. How is everyone else dealing with this type of thing? Is there conventional wisdom there?

    Thanks.

  • #2 / Aug 05, 2010 4:40pm

    Ingmar

    29245 posts

    You’ll probably want to turn on strict urls and combine that with require_entry=“yes”.

  • #3 / Aug 09, 2010 10:25am

    grovberg

    50 posts

    Wow, that was ridiculously prompt and exactly what I needed. Thanks so much.

  • #4 / Aug 09, 2010 10:47am

    Sue Crocker

    26054 posts

    Glad Ingmar was able to help. Don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases