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" from title_permalink and other tags

July 02, 2007 2:55am

Subscribe [5]
  • #1 / Jul 02, 2007 2:55am

    RJB

    35 posts

    Like many ExpressionEngine users, I have followed the instructions to remove “index.php” from my site (using Apache’s mod_rewrite).

    However, I’d also like to remove the “index.php” that’s automatically output from using ExpressionEngine tags, such as {title_permalink=template_group/template/index}, which will spit out “domain.com/index.php/template_group/template/entry-name”

    I have erased the “index.php” from all of the weblog’s path settings and it stubbornly insists on outputting “index.php”—so I’m left to believe ExpressionEngine is outputting the “index.php” on its own.

    Does anyone have any experience on removing the “index.php” from the links ExpressionEngine outputs, and if so how did you make it possible?

  • #2 / Jul 02, 2007 3:00am

    Lisa Wess

    20502 posts

    Leaving it blank in general config should work - are you sure it’s *staying* blank?

    Also, make sure that your path.php doesn’t have index.php listed in there.

  • #3 / Jul 02, 2007 3:10am

    RJB

    35 posts

    Leaving it blank in general config should work - are you sure it’s *staying* blank?

    Yes, I have double-checked and made sure I have cleared all of the path setting’s input fields and erased any reference of “index.php”—they’re so blank they’re naked.

    Also, make sure that your path.php doesn’t have index.php listed in there.

    Correct, my “path.php” file does not have an “index.php” reference anywhere in it.

  • #4 / Jul 02, 2007 3:13am

    Lisa Wess

    20502 posts

    You mentioned your weblog path settings, but in Admin ›  System Preferences ›  General Configuration: you have removed it there?  That’s what is used for the path= type statements.

  • #5 / Jul 02, 2007 3:17am

    RJB

    35 posts

    You mentioned your weblog path settings, but in Admin ›  System Preferences ›  General Configuration: you have removed it there?  That’s what is used for the path= type statements.

    Bingo! I had overlooked removing “index.php” from the setting for Name of your site’s index page. Once it was erased all of the “index.php” references disappeared from the output hyperlinks.

    Who knew there could be so many places for the “index.php” setting to hide? Thank you, Lisa!

  • #6 / Jul 02, 2007 3:18am

    Lisa Wess

    20502 posts

    Glad you found it! =)

  • #7 / Jan 09, 2008 9:02pm

    Florian Fangohr

    20 posts

    Just wanted to chime in thank you too…

    I have been looking for this option for ages.

    😊

  • #8 / Jul 06, 2009 12:28am

    tubes1

    32 posts

    So, I know that this has been solved for a while but there is a problem with leaving the field in the general config of the Control Panel blank. The “my site” and the main Expression Engine link in the top left corner of the CP don’t work anymore. It seems to need that index.php to do its redirect thing mentioned here.

    Is there any compromise?

  • #9 / Jul 06, 2009 4:05am

    Ingmar

    29245 posts

    It depends on how you do your rewriting. Removing index.php from your URLs is not supported, but there’s a wealth of information in the wiki.

  • #10 / Jul 06, 2009 11:45am

    tubes1

    32 posts

    I’m using the file and directory check method. I didn’t see anything about removing the index.php from permalinks but there was mention of removing it from pagination via the Find and Replace plugin. So, I thought I’d try it on permalinks too.

    Here is what I did (and it seems to work):

    I left index.php in the “Name of your site’s index page” on the General Config page. This ensures that “My site” and any other links you create in the CP, along with the link to the Expression Engine site work properly.

    However, leaving it means that permalinks and pagination will all display the index.php in URLs. The pages will work but they’ll have index.php in them, which defeats the point of removing it in the first place.

    So, install the Find and Replace plugin and wrap the following around any entry tags or pagination tags.

    {exp:replace find="/index.php"} your permalink and paginate tags {/exp:replace}

    This will remove the index.php.

    Here is an example in my code. I had permalinks and pagination all in one place so I wrapped the whole thing and it seems to be working fine.

    {exp:replace find="/index.php"}{exp:weblog:entries weblog="newsandtips" limit="8" disable="trackbacks"}
    <div class="articlepreviewwrapper">
        <h2><span>{title}</span></h2>
    <p>    <h3 class="date">{entry_date format="%F %d, %Y"}</h3><br />
        {article_excerpt}<br />
        <a href="http://{title_permalink=">Read full article…</a><br />
    </div><!-- end articlepreviewwrapper --><br />
    {paginate}Page {current_page} of {total_pages} pages {pagination_links}{/paginate}<br />
    {/exp:weblog:entries}{/exp:replace}

    More trouble than a moose on the interstate but everything works!

    Looking forward to 2.0 where removing index.php is supported. Then, hopefully that will be the end of all the hackety hack hacks!  😊

  • #11 / Jul 06, 2009 11:58am

    Sue Crocker

    26054 posts

    Looks like the original question was answered.. closing thread. Don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases