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.

periods in URLs (part 2)

November 22, 2011 4:04pm

Subscribe [3]
  • #1 / Nov 22, 2011 4:04pm

    tunnel7

    125 posts

    This question may be related to a resolved thread.

    Hello.  I previously had posted on this topic and was directed to this fix: http://ellislab.com/forums/viewthread/161066/P18/#882338 which had worked for me in the past.  However today it did not and I even dug into Derek’s fix and changed the codeigniter files but still no luck - periods in the URLs are still appearing.

    Is there another option?  I am running v2.2.2 - Build: date 20110801 on this project.

    Thanks in advance for your help.

    p.s. would love to see the defaults here be not to allow periods in URLs as this has come up a few times for me.

  • #2 / Nov 23, 2011 3:12pm

    Kevin Smith

    4784 posts

    Hi Derek,

    I can confirm that the settings in $config[‘permitted_uri_chars’] don’t seem to affect EE’s creation or acceptance of URLs, and that’s a problem. We shouldn’t have to get into hacks to make it work. Hang tight for me while I bring in one of the devs on this discussion to see if we can get a plan in place for making this work as expected.

  • #3 / Nov 23, 2011 9:26pm

    tunnel7

    125 posts

    Thanks Kevin.  I appreciate the follow up.

  • #4 / Nov 29, 2011 2:54pm

    Kevin Smith

    4784 posts

    Hi Derek,

    I got word back from Robin on this. Here’s a hack that should work, but the hack isn’t the best long-term way to go. She recommends creating an extension or accessory to handle the url_title creation in the Publish Page.

    Here’s the gist of her response:

    You can hack it EE_url_helper.php (extends CI’s Url helper). Find this starting on line 59:

    $trans = array(
          '&\#\d+?;'     => '',
          '&\S+?;'     => '',
          '\s+|/+'     => $separator,
          '[^a-z0-9\-\._]'   => '',
          $separator.'+'    => $separator,
          '^[-_]+|[-_]+$'    => '',
          '\.+$'      => ''
           );

    Alter the one line to

    '[^a-z0-9\-_]'   => '',

    - note removal of the dot.

    And then the JS that strips it in the Publish Page when creating the url_title is ee_url_title.js, same deal. Look for:

    [^a-z0-9\-\._]

    And change it to:

    [^a-z0-9\-_]

    Same deal- don’t allow the period.

    Does that help?

  • #5 / Nov 29, 2011 2:55pm

    Robin Sowell

    13255 posts

    Sorry for the confusion on that one- the CI setting is not one that’s meant to have any effect on EE urls- see the note in the config:

    /*
    |--------------------------------------------------------------------------
    | ExpressionEngine Config Items
    |--------------------------------------------------------------------------
    |
    | The following items are for use with ExpressionEngine.  The rest of
    | the config items are for use with CodeIgniter, some of which are not
    | observed by ExpressionEngine, e.g. 'permitted_uri_chars'
    |
    */

    EE simply isn’t currently coded to use a config setting to specify allowed characters in the uri.  You can see it in EE_url_helper.php (extends ci’s Url helper) where it creates url_titles- it’s currently hard coded what it will allow.  The same is true of the javascript that creates url_titles as you type (ee_url_title.js).

    In the short term- a hack of the url helper might be acceptable in an emergency.  And I can see about adding a way to further restrict allowed characters from title creation- though a feature request won’t be of immediate help.  Hrm- and someone very clever with javascript might be able to do an extension/addon that adds to the ee_url_title.js behavior.

    But currently, the config isn’t meant to affect EE’s url creation.

    ETA- ignore me!  Kevin’s already laid it out in more detail!

  • #6 / Dec 04, 2011 1:42pm

    Kevin Smith

    4784 posts

    Does that help answer your questions, Derek?

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

ExpressionEngine News!

#eecms, #events, #releases