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]
  • #1 / Oct 09, 2008 6:25pm

    Leslie Camacho

    1340 posts

    Note: Strict URLs changed between this posting and the release of 1.6.5. Please see the Strict URLs section of the User Guide for details.

    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.

    Post Permalink.

  • #2 / Oct 09, 2008 6:55pm

    Ryan Irelan

    444 posts

    Excellent addition. Glad to see it coming in 1.6.5!

  • #3 / Oct 09, 2008 7:03pm

    Kurt Deutscher

    827 posts

    If the first segment exists and does not correlate to a valid Template Group, ExpressionEngine will display a 404 page and send 404 status headers.

    How will it handle custom URIs from the pages module?

    http://www.mydomain.com/index.php/pages

    Will it check the pages module links before sending out the 404?

  • #4 / Oct 09, 2008 7:16pm

    Derek Jones

    7561 posts

    Yes, the Pages module will still work.  For the curious, the internal mechanism is that Pages URIs are examined before any template processing is done.  If a Page URI is matched, it forces the template parser to render the URI with the assigned template group and template, and with that Page entry’s entry id.

  • #5 / Oct 09, 2008 7:25pm

    Kurt Deutscher

    827 posts

    This is so cool! Thanks for the new functionality.

  • #6 / Oct 09, 2008 7:49pm

    angstmann

    225 posts

    Excellent news. Another caveat of the current version of EE bites the dust, which can only be a good thing.

  • #7 / Oct 09, 2008 7:55pm

    GDmac - expocom

    350 posts

    How will the current 404 setting of the global-template-preferences play a part in this?
    Is this strict-stuff a general setting (and do we have to point to a 404 template)...

  • #8 / Oct 09, 2008 8:05pm

    Derek Jones

    7561 posts

    It’s a separate setting, GDmac.  If you’re currently using the 404 Page feature, then Strict URLs will be enabled when you run the update.  Further, each site in MSM has its own Strict URL setting, and will be toggled based on its own current 404 Page setting.

  • #9 / Oct 09, 2008 8:46pm

    28Bytes

    192 posts

    When reading the post, what do you mean by you will not be able to shortcut around the default template group?

  • #10 / Oct 09, 2008 9:08pm

    Leslie Camacho

    1340 posts

    When reading the post, what do you mean by you will not be able to shortcut around the default template group?

    The first example in the post is the “short cut” I’m referring to. On occassion people will design an EE site in a way that is supposed to ignore the first URL segment. They might have a setup something like this:

    my_site (Default Template Group)
    - index
    - news
    - calendar

    You’re supposed to reference the URL in EE like so:

    <a href="http://example.com/index.php/my_site/news/">http://example.com/index.php/my_site/news/</a>

    But for whatever reason a person will skip the initial URL segment and specify that the URLs do this instead:

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

    But what EE is really rendering is my_site/news/. This works in the current version of EE but will not work if Strict URLs is enabled.

  • #11 / Oct 09, 2008 9:13pm

    lebisol

    2234 posts

    So it is either strict URLs with path variables now including the “default-template-group” or showing the “default-template-group” in URLs of the browser? Now I am confused…

    Why not just have fixed/non-editable “root” for default group that will not ever be processed?

    Above all…why are you guys working on 1.6 anything…taking the time away from the precious child 2.0…kidding 😊

    Thanks for the explanations for us 404 challenged.

  • #12 / Oct 10, 2008 2:20am

    mapu

    7 posts

    What, if the index.php has been removed via .htaccess? Will this feature still work?

  • #13 / Oct 10, 2008 2:43am

    Derek Jones

    7561 posts

    What, if the index.php has been removed via .htaccess? Will this feature still work?

    Removing index.php is at its basest form a server trick.  I mean, that ExpressionEngine is only executed when index.php is requested by the server; mod_rewrite merely lets you hide this fact from the visitor.  ExpressionEngine still sees the URL segments that your .htaccess rules provide, so as long as the rewritten rule follows the above conventions, whether or not you have renamed or removed index.php from your visitor’s URLs does not matter.

  • #14 / Oct 10, 2008 3:42am

    NKT com

    124 posts

    Is there anything that can be done about trailing slashes? I notice Wordpress cleans this up and is very strict. In EE…

    mysite.org/templategroup/template/url-tile

    and

    mysite.org/templategroup/template/url-tile/

    both work and I’ve had pages excluded from ranking for duplicate content before.

  • #15 / Oct 10, 2008 4:30am

    Brendon Carr

    135 posts

    Removing index.php is at its basest form a server trick.  I mean, that ExpressionEngine is only executed when index.php is requested by the server; mod_rewrite merely lets you hide this fact from the visitor.  ExpressionEngine still sees the URL segments that your .htaccess rules provide, so as long as the rewritten rule follows the above conventions, whether or not you have renamed or removed index.php from your visitor’s URLs does not matter.

    But this won’t work with sites that have removed the template group by mod_rewrite, will it?

    At the risk of dispelling my image as an aggressive drunk, this sounds like a great feature for ExpressionEngine.