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.

Better 404s with Strict URLs

October 09, 2008 6:25pm

Subscribe [23]
  • #31 / Oct 10, 2008 4:31pm

    Lost Cause

    9 posts

    Is there anything that can be done about trailing slashes?

    I agree and hope that this is solved in EE 2, right now there are two valid ways to access pages, with a slash and without. If you’re concerned about duplicate content as far as search engines are concerned, well here’s another example.

    Here’s what I do in my htaccess to address the trailing slash issue (i don’t want trailing slashes):

    # remove trailing slash if not a directory
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)/$ /$1 [R=301,L]

    And anywhere in the templates where it displays a link, I use a plugin (slashee) to remove trailing slashes. Works well, but this should be built-in to EE.

  • #32 / Oct 10, 2008 4:35pm

    Lost Cause

    9 posts

    I’m happy to hear that correct 404 headers will be sent by EE when content is not found. However, what about when we want to manually throw a 404 due to not finding results (for dynamic pages or whatever):

    {if no_results}
    {redirect="site/404"}
    {/if}

    Right now it simply redirects to the 404 page but no 404 headers are sent. So what I’ve done is use the trick in the wiki to make the 404 page always display with 404 headers. Will there be a proper solution for manually throwing 404 page errors and having the correct 404 headers being sent?

  • #33 / Oct 10, 2008 4:37pm

    Derek Jones

    7561 posts

    I’m happy to hear that correct 404 headers will be sent by EE when content is not found. However, what about when we want to manually throw a 404 due to not finding results (for dynamic pages or whatever):

    {if no_results}
    {redirect="site/404"}
    {/if}

    Right now it simply redirects to the 404 page but no 404 headers are sent. So what I’ve done is use the trick in the wiki to make the 404 page always display with 404 headers. Will there be a proper solution for manually throwing 404 page errors and having the correct 404 headers being sent?

    Lost Cause, you need to use {redirect="404"} in order for the 404 headers to be sent with your 404 page.

  • #34 / Oct 10, 2008 5:00pm

    Lost Cause

    9 posts

    Lost Cause, you need to use {redirect="404"} in order for the 404 headers to be sent with your 404 page.

    I’m embarrassed I missed that, thank you!

  • #35 / Oct 11, 2008 3:23pm

    Riverboy

    2993 posts

    Originally planned as a feature for 2.0, Strict URLs will be sneaking into EE 1.6.5 (due soon). So this time around you get a preview of a 2.0 feature that you won’t have to wait for 2.0 to start using.

    will be sneaking into EE 1.6.5 (due soon)....  😛 Ok, now i cant sleep…thanks a lot =)

    Nice to know about these things. need to think what to do with this. And PS. this was new to me:

    {path='weblog/index'}

    This is what we’ve always recommended. It also means that you will no longer be able to “short cut” around the default site Template Group.

    So thanks for that too!

    Thumbs up for all the team members!
    Cheers:
    - Tuittu

  • #36 / Oct 11, 2008 5:42pm

    soxhead

    69 posts

    Awesome. This is great—thanks EE team.

  • #37 / Oct 12, 2008 7:50am

    Nora

    41 posts

    That’s amazing news. Thank you for working on this 😊

  • #38 / Oct 12, 2008 4:51pm

    Riverboy

    2993 posts

    will be sneaking into EE 1.6.5 (due soon)....  😛 Ok, now i cant sleep…thanks a lot =)

    Okey, have to give up and get some sleep =)

  • #39 / Oct 13, 2008 5:14am

    Adam George

    283 posts

    If I have setup this template group/templates:

    news/index
    news/foo
    news/bar

    And I use this link (i.e. using a plain link, NOT using {path=""}):

    <a href="http://www.example.com/news/">News</a>

    Will the user go to this page? (As happens now)

    <a href="http://www.example.com/news/">http://www.example.com/news/</a>
  • #40 / Oct 13, 2008 8:57am

    Derek Jones

    7561 posts

    If I have setup this template group/templates:

    news/index
    news/foo
    news/bar

    And I use this link (i.e. using a plain link, NOT using {path=""}):

    <a href="http://www.example.com/news/">News</a>

    Will the user go to this page? (As happens now)

    <a href="http://www.example.com/news/">http://www.example.com/news/</a>

    Yes, since your first segment is a valid template group.  ‘index’ will still work as an analogue to an index.html file for your template groups, and is displayed when no second segment is given.

  • #41 / Oct 13, 2008 9:08am

    Adam George

    283 posts

    TY

  • #42 / Oct 15, 2008 5:20pm

    Carlos Pero

    6 posts

    Leslie, I’ll bet you dislike these kind of inquiries….but can you say how far away 1.6.5 is?  Days or weeks? 

    I’m asking because I need to solve this problem for a production site we just launched, and don’t want to invent/employ workarounds if this “real” fix is just around a corner.

  • #43 / Oct 15, 2008 5:27pm

    Derek Jones

    7561 posts

    Zuul, which part in particular are you needing solved?  Be specific please; without knowing your situation, it’s possible that existing tools address your needs.

  • #44 / Oct 16, 2008 8:28am

    Carlos Pero

    6 posts

    Zuul, which part in particular are you needing solved?  Be specific please; without knowing your situation, it’s possible that existing tools address your needs.

    Strict URLs.  In particular, to use examples from your blog, I need the ability to make invalid URLs like this not work:

    http://expressionengine.com/showcase/read/not_the_right_permalink_for_latest_post/
    http://expressionengine.com/blog/category/not_a_real_category/

    I’m able to take care of the first one with require_entry=“yes” and

    {if no_results}
    {redirect="404"}
    {/if}

    The category page is harder.  Attempting to use {if category_request}, the best I can do is show a blank page in response to a malformed URL.  But it only works with Category URL Titles In Links disabled!

    Lastly, and probably most troubling, I can’t figure out how to make a page like this not render the index page:

    http://expressionengine.com/blog/dont_link_to_this_url/

  • #45 / Oct 16, 2008 11:15am

    Derek Jones

    7561 posts

    There are some PHP based solutions you could use if you search the forums, Zuul, but 1.6.5 is coming in days, not weeks, so it may be best to wait for that update.

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

ExpressionEngine News!

#eecms, #events, #releases