17

What does "Enable Strict URLs" really mean and are there any security/other implications if I choose to not use strict URLs?

| improve this question | | | | |
19

My URL schematic points out the difference it makes to the regular flow - might be helpful:

http://www.jamessmith.co.uk/articles/expressionengine_url_schematic

As you can see from the diagram, it prevents EE from determining a template via methods #2 and #4 method #2 as numbered there (and as alluded to in the other answers).

For me the benefit of more reliable 404's doesn't outweigh the advantage of being able to determine a template in these ways this way, so I never enable it.

[answer corrected May 2013 - You CAN have Strict URLs turned on and still use method #4.]

| improve this answer | | | | |
  • 2
    Awesome! totally forgot about that schematic. We should add that to the wiki here. – CreateSean Nov 22 '12 at 14:21
  • 2
    That schematic is going to be added to my debug toolbox. Thanks James pure gold. – since1976 Nov 22 '12 at 18:41
  • 2
    My pleasure. @CreateSean what and where is there a wiki here? Can't see that anywhere? It's a strange old game this Stack Exchange malarkey. – James Smith Nov 22 '12 at 23:35
  • 1
    James, there's supposed to be a wiki, but I haven't figured it out yet. might be something that happens when we have users with higher rep. – CreateSean Nov 23 '12 at 0:54
9

With Strict URLs off, if your first segment doesn't correspond to an existing template group, EE will then look for a template with the same name in your default template group, and render that template if found.

Enabling Strict URLs prevents the behaviour - if {segment_1} is not a template group (and your URL is not a Pages URL), you'll get a 404.

| improve this answer | | | | |
5

My understanding of strict urls is as follows:

Lets say you have a news template/channel.

if you go to site.com/news/ this (assuming you've coded it so) will show you a list of all news items on the page.

You now have a site.com/news/view/url_title_here which is a single list page based on the last segment being the URL_TITLE of the news item.

My understanding with strict URL's is that if you were to go to site.com/news/view/ without strict url's being enabled, it would simply show the 'latest' news item - however with it enabled, it will error/404.

At least thats always been my understanding.

| improve this answer | | | | |
  • That's basically how I understand it too. – foamcow Nov 22 '12 at 9:09
  • 1
    There's an additional effect of enabling strict URLs that has caught me out before: with it on, you can view templates in your default template group directly by template name, without specifying the group in the URL, eg: example.com/template_name, whereas with it off you cannot, and must access them as example.com/template_group/template_name. – Tom Davies Nov 22 '12 at 9:21
  • 1
    Tom - I think you mean that in reverse? Strict URLs on means that you always need to specify the template group. – Derek Hogue Nov 22 '12 at 13:25
  • 1
    @madebyhippo - this is actually not true. This behaviour only occurs if you specify require_entry="yes" in your Channel Entries tag, and then you add {if no_results}{redirect="404"}{/if}. Strict URLs has no effect on the scenario you describe. – Derek Hogue Nov 22 '12 at 13:30
  • @DerekHogue, you're quite right - will amend my comment – Tom Davies Nov 22 '12 at 18:56
1

Backing up a little: My understanding is that Strict URL's were implemented because of duplicate content* issues - duplicate content is rarely an issue at all anyway. Google will just decide to index 1 page. It would be possible to run into a canonical issues but again that's rare.

  • Different duplicate content than copying other sites and trying to out rank for that content.

Personally i don't run strict urls as it makes url's ugly although- by reading above i need to revisit and test a few things for clarification in my mind how exactly it works.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.