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.

Allowed URI Characters Config (Periods in URI's Throwing 404)

March 03, 2011 4:18pm

Subscribe [3]
  • #1 / Mar 03, 2011 4:18pm

    bsrweb

    24 posts

    Hello!

    I’m running into an issue where EE will throw a 404 when periods are in URI’s and I think I’ve distilled the issue down to the rules in my htaccess file. I know this forum doesn’t officially give support for htaccess configurations but I thought I could get around the problem by removing the “.” in the permitted_uri_chars line in the config.php file.

    So, I did that and when I create a new entry to test that by adding periods in the Title field, the URL Title field continues to automatically add the periods.

    What am I doing wrong?

    Here’s the value in the permitted_uri_chars config:  a-z 0-9~%:_\-

    Running EE 2.1.3 w/ MSM 2.1.0

    And for what it’s worth, here’s the rules in my htaccess file:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteRule ^(.*)$ /index.php?$1 [L]
  • #2 / Mar 03, 2011 4:37pm

    Ingmar

    29245 posts

    Is it working as expected without url rewriting?

  • #3 / Mar 03, 2011 4:41pm

    bsrweb

    24 posts

    Hi, thanks for your response.

    Yes, if I remove the rewrite rules in the htaccess file, EE correctly displays an entry with periods in the URI.

  • #4 / Mar 04, 2011 9:09am

    Ingmar

    29245 posts

    Are we sure this is an EE 404 error? What message are you getting, exactly?

  • #5 / Mar 04, 2011 3:54pm

    bsrweb

    24 posts

    Ah, that’s a good question. In my template global preferences, I have Enable Strict URLs set to “no”; and in the next field, I’m pointing the 404 to our 404 page template.

    When a URI has a period in it, EE will display the most recent entry in the channel and not the 404 page.

  • #6 / Mar 05, 2011 2:20pm

    Greg Salt

    3988 posts

    Hi bsrweb,

    Firstly, please replace the period in the permitted_uri_chars in the config file. Then, please temporarily disable your .htaccess file and replace the Site Index file in your site General Configuration. EE should work correctly with periods in URIs. Can you give us an example of something that isn’t working? With regards to the 404 template not displaying this should work if you enable strict URLs.

    Cheers

    Greg

  • #7 / Mar 05, 2011 9:42pm

    bsrweb

    24 posts

    Hi Greg,

    Thanks for the suggestion but I’m not sure what this is supposed to test? I can confirm that if I do all those things, periods in URIs work just fine and I can’t give any examples of something that’s wrong.

    To distill my issue down to what EE has control over though, if I remove the period from the allowed_uri_chars config, EE shouldn’t automatically insert periods into the URL Title field, no? Can someone confirm this?

    Cheers!

  • #8 / Mar 07, 2011 2:37am

    John Henry Donovan

    12339 posts

    bsrweb,

    We wished to confirm that everything was working fine without htaccess or the change in the config file

    Can you try one thing please?
    Open up your config.php file and change

    $config['uri_protocol']    = 'AUTO';

    to

    $config['uri_protocol']    = 'PATH_INFO';

    to start with and test with the period in your title again.
    Try the other values if that doesn’t work

  • #9 / Mar 07, 2011 1:55pm

    bsrweb

    24 posts

    Ah, I see, thanks for the explaination.

    I changed the url_protocol value to “PATH_INFO” and with nothing in my htaccess file and the period back in the permitted_uri_chars config setting, all works fine. In other words, no change, which is good.

    Going forward from there, I put my rules back into my htaccess file and now, no pages will display — all page requests goes to our home page, having strict URLs not set.

    I then changed the url_protocol value from PATH_INFO to REQUEST_URI, and all seems to be working again. At least, on my development environment… crossing my fingers this works on production.

    Thanks for pointing out this url_protocol configuration.. never knew about this before so nice to learn something new.

  • #10 / Mar 07, 2011 5:11pm

    Ingmar

    29245 posts

    So, you’re good? Please let us know this works for you, thanks.

  • #11 / Mar 07, 2011 6:53pm

    bsrweb

    24 posts

    Yes, I made the uri_protocol change on our production system and all seems to be working, thank you!

  • #12 / Mar 08, 2011 4:14am

    John Henry Donovan

    12339 posts

    Great stuff! Feel free to start anew thread if you have any more questions.

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

ExpressionEngine News!

#eecms, #events, #releases