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.

Remove index.php without breaking up url_title with punctuation

April 15, 2011 6:50am

Subscribe [2]
  • #1 / Apr 15, 2011 6:50am

    Stefan Rechsteiner

    442 posts

    hi folks

    Right now I’m using the following .htaccess to remove the incredibly ugly /index.php from my EE2 URLs:

    RewriteEngine On
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    … everything works great — except if a entries {url_title} contains punctuation (like: domain.com/news/article/apple-releases-ios-4.0-for-iphones ). The Page will be left blank … but if I add index.php/ by myself into the url, the entry is shown.

    Is there a better .htaccess-Code which does not break up these entries with punctuation in the title?

  • #2 / Apr 15, 2011 9:19am

    michaelroling

    34 posts

    I’m curious…try removing this line from your .htaccess:

    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]

    I think this rewrite condition is turning out to be true because of the \.

  • #3 / Apr 15, 2011 9:34am

    Stefan Rechsteiner

    442 posts

    hi michaelroling
    nothing changes if i remove this line … still not working… :-/

  • #4 / Apr 15, 2011 10:49am

    michaelroling

    34 posts

    Ok, scrap that idea, remove the last line of your htaccess rewrite and replace it with this:

    RewriteRule ^(.*)$ /index.php/$1 [L]

    The ? may be throwing it.

  • #5 / Apr 15, 2011 11:02am

    Stefan Rechsteiner

    442 posts

    If i remove the ‘?’, the whole site breaks down! 😉 … else, just and only the entry isn’t showing, the rest of the site works just fine

  • #6 / Apr 15, 2011 11:17am

    michaelroling

    34 posts

    The htaccess code that I gave you was from this bug report: https://support.ellislab.com/bugs/detail/13120/#8892

    It worked for him.

  • #7 / Apr 15, 2011 11:48am

    Stefan Rechsteiner

    442 posts

    Strange — if I remove the ? the error «No input file specified.» appears and nothing else gets rendered … if i remove the / the page get’s rendered, but without the entry … only the no_results get’s displayed.

    btw: If I remove the require_entry=‘yes’ parameter from the exp:channel:entries-loop, the entry get’s displayed (!!!)… but the embeded comments-template does not… and of course there is a lack of usability because the require_entry-parameter isn’t set and the article-template without an entry displays the most current entry instead of 404 or template_group/index.php

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

ExpressionEngine News!

#eecms, #events, #releases