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.

404 handling problems

September 30, 2010 7:14am

Subscribe [1]
  • #1 / Sep 30, 2010 7:14am

    IDF MARKETING

    23 posts

    I have turned on strict URL’s and am able to generate the 404 for pages that don’t exist at segment_1 however at segment_2 it will not trigger, it just stays on the index of that template group i.e.

    mysite.com/about/dfdfdf - just stays on about page but:

    mysite.com/asfsdfd - will trigger the 404.

    I have index.php removed via the htaccess.

    I find it increaingly frustrating to get 404 templates working correctly in EE, WordPress handles them perfectly out the box which is great for SEO.

    I have read on conditionals for segments to trigger but this method does not suit our template structure because we are using some templates to display a list of entries plus the single entry.

  • #2 / Sep 30, 2010 8:16am

    IDF MARKETING

    23 posts

    bump

  • #3 / Sep 30, 2010 11:33pm

    Lisa Wess

    20502 posts

    Hi, IDF Marketing -

    My apologies that it has taken a bit to get a response to you.  I do want to point to a part of our support policy on support request handling - just to point out how we order handling on the support forums.

    404s look for a valid template group in segment 1. To check segment 2 you need to use the conditional in the strict url docs:

    {if segment_2 != ''}
      {redirect="404"}
    {/if}

    I have read on conditionals for segments to trigger but this method does not suit our template structure because we are using some templates to display a list of entries plus the single entry.

    Can you clarify your template structure? Are you using the index template, based on segment conditionals to display different content?

  • #4 / Oct 01, 2010 5:05am

    IDF MARKETING

    23 posts

    Hi Lisa,

    I have a portfolio template group - in that index template is conditions that says

    {if segment_1=="portfolio" AND segment_2==""}
    then show all of the portfolio items as thumbnails
    {/if}
    
    {if segment_1=="portfolio" AND segment_2!=""}
    Show me the single portfolio piece because the segment 2 is going to be the url title of the portfolio piece
    {/if}

    I have it set like that in order to keep the URL short and clean rather than having another template called piece for example - i.e. portfolio/piece/name_of_work_item

    You can see that I can not use segment_2 conditionals with a template structure like this.

  • #5 / Oct 01, 2010 4:32pm

    Lisa Wess

    20502 posts

    Hi, IDF Marketing - in your situation, you won’t be able to check for a valid template group.  If you want to use that feature of strict URLs, you would be best to separate your templates instead of using that conditional as you posted in #3.

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

ExpressionEngine News!

#eecms, #events, #releases