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.

Why periods or dots may very well not work in EE 2.x, and how to fix it

July 16, 2010 8:09pm

Subscribe [2]
  • #1 / Jul 16, 2010 8:09pm

    narration

    773 posts

    I used a debugger on a fresh EE 2.1/Agile Demo installation to find out why this will often not work, as has happened here, and to enough others since 2.x was first released.

    The short answer is that if a question mark appears in the URI, then EE 2.x will accept PHP’s idea of the request as what is called a GET. Then, as documented on this page, recent versions of PHP insist on forcing a conversion of periods, or ‘dots’ as they call them, to underscores in the values that are used by EE.

    These resulting underscores don’t match to your period-included url_title, and so you get the local version of a Page Not Found 404 error. If you happen to be printing segments there, you’ll see the incorrect url_title that was passed.

    You can repair this problem if your server setup isn’t one of those which require EE’s paths to be passed as a Query string, with the question mark. Be aware that you may or may not see visibly that you have a question mark in the URL string. It can be put there for example by .htaccess rewrites which eliminate index.php—most of the examples for this have the question mark present.

    The same error should happen if you have set Force URL query strings to Yes under Admin:System Administration:Output and Debugging Preferences in the Control Panel.

    Unless you are on one of the problem server configurations, you can remove the question mark addition from .htaccess, or turn it off in the Control Panel, as appropriate. At this point periods in url_titles should start working on EE 2.1.

    One place to check besides url_titles on your site would be the RSS template. If you are using one of the examples from earlier times which are named rss_2.0, it will have the same potential issue and cure.

    That’s where I had the problem, though I understand now particularly from the lawyers-want-their-formal-initials case that there can be times when periods might be natural to use.

    I suspect though that in view of the many ways this can be an issue if the url_title—not the posting title itself—contains periods, that EE should give the option that underscore replacements will always be emitted and accepted.

    Regards,
    Clive

    [Mod Edit: Moved to the Codeshare Corner]

  • #2 / Sep 19, 2013 2:00am

    Sunnyland

    66 posts

    Hey so is there a way to automatically remove dots, exclamation marks etc from url titles, or an option about which characters to remove or replace with underscores via a regex or similar??

    I want to this since I’m using url_titles in a number of ways that are affected by the unintended period (which will have reason to be used by site members on occasion, but which I don’t want in the url_title).

    > edit:


    Okay I found this in an old post…

    http://ellislab.com/forums/viewthread/178015/

    ... which mentions the url helper file and an array to edit..

    I’ve given it a shot, as instructed, but it doesn’t seem to have any effect on preventing the period from coming into the url_title from the title.

    I’ve also tried fiddling with the other bits, like removing the period from what seems to be the allowed character exceptions etc…

    If someone else can take a look and see if they can get this to work, or has done something like this previously, and you could let me know, that would be swell.

    Cheers.

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

ExpressionEngine News!

#eecms, #events, #releases