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.

Custom Index.php Name and Removing it

June 11, 2012 12:31pm

Subscribe [1]
  • #1 / Jun 11, 2012 12:31pm

    vw000

    482 posts

    This question may be related to a resolved thread.

    Well the problem is that now segment url display the file name in the link like

    example.com/file.php/segment

    Is this setting completely incompatible with EE? Using a custom index.php but not displaying the file name?

    If leave the index.php name field blank, of course it works, but then CSS does not work.

  • #2 / Jun 13, 2012 11:07am

    Dan Decker

    7338 posts

    Hi Nibb,

    If you went to remove and rename index.php you need to also modify .htaccess to account for the new name:

    <IfModule mod_rewrite.c>
            RewriteEngine On
    
            # Removes index.php
            RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /file.php/$1 [L]
    
            # If 404s, "No Input File" or every URL returns the same thing
            # make it /index.php?/$1 above (add the question mark)
    </IfModule>

    I hope that helps.

    Cheers,

     

  • #3 / Jun 13, 2012 8:25pm

    vw000

    482 posts

    Actually that was the first thing I did.

    I already replaced “index.php” in the .htaccess file with my own index page name.

    Now if I leave the index custom name in the EE control panel everything works just fine except that links created by EE with segments, links in the source code to CSS files, and actually any link created by EE displays the filename like this:

    filename.php/segment1/

    If I remove it from there (like you would if it was named index.php) then it breaks the templates generated by EE and other stuff.

    You could say why not just use the default index.php right?

    Well, my index.php is already in use by another content system, a billing system and I cannot replace it. This is why I decided EE should (and can´t) use the name index.php but needs another name for this.

    Now this work ok and .htaccess removes the filename in the url but of course every link created by EE contains the file name as the index name is listed under the control panel in “Name of your site’s index page”

    It seems this setup EE does not like. You can only leave that field blank if the file name defaults to index.php. Can someone confirm this?

    Because all my links created by EE are ugly, even when I can browser the urls just fine without using the index filename as the .htaccess makes its magic. The problem is EE which does not let me leave that setting blank in the control panel.

    This is a HUGE problem in my case to the point I could decide not to use EE at all.

    My current root index.php is encoded, so its needs IonCube. I tried to import this into a EE template and them make this as default homepage, then I could replace the default EE index with it, and use this template but of course this does not work. It gives errors as this ioncube PHP data cannot be parsed via ExpressionEngine and needs to be parsed directly. So the only solution for me was to actually rename the EE index.php to something else.

    Now why this is a problem? Because all the navigation which is generated by EE display the file name and Google will not index all the urls with this which is plain SEO bad but it also looks visually bad for visitors.

    I really need ExpressionEngine not to use the index.php file at all, and leaving this setting blank breaks my site. The .htaccess rules work just fine with any filename, but EE does not like the index.php setting to be left blank if the name is not actually index.php

    EE assumes your index file name is index.php when you set this to blank.

  • #4 / Jun 14, 2012 4:04pm

    vw000

    482 posts

    Solved.

  • #5 / Jun 15, 2012 3:51pm

    Dan Decker

    7338 posts

    Hi Nibb,

    I’m glad to see you have a solution! Do you mind sharing it with the Community?

    Cheers,

  • #6 / Jun 15, 2012 4:57pm

    vw000

    482 posts

    I changed the index priority in Apache to give higher priority to my custom EE index name then I could leave the setting empty in EE so it works.

  • #7 / Jun 18, 2012 4:37pm

    Dan Decker

    7338 posts

    Hi Nibb,

    Awesome! Excellent solution, thanks for sharing.

    If you need us for anything else, please let us know.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases