Jump to:

23553 Posts in 19380 Topics by 2892 members

General Questions

SilverStripe Forums » General Questions » index.php added to base href

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 21172 Views
  • GibMo
    Avatar
    Community Member
    17 Posts

    index.php added to base href Link to this post

    I have been working on a SS test website for some time now. And recently I found "index.php" was being added to the urls. I am pretty sure this was not the case from the start. But I have been modyfing and adding a lot of files so I am not sure if I changed something.

    When I remove the "index.php" from a single url and I start navigating everything is ok, until I get back to my homepage. From there "index.php" is being added again.

    After reading some posts I tried modifying the .htaccess file several times with no result.
    Please help

    .Htaccess

    ### SILVERSTRIPE START ###
    <Files *.ss>
       Order deny,allow
       Deny from all
       Allow from 127.0.0.1
    </Files>

    <Files web.config>
       Order deny,allow
       Deny from all
    </Files>

    <IfModule mod_rewrite.c>
       RewriteEngine On
    RewriteBase /
       RewriteCond %{REQUEST_URI} ^(.*)$
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
    </IfModule>
    ### SILVERSTRIPE END ###

  • swaiba
    Avatar
    Forum Moderator
    1796 Posts

    Re: index.php added to base href Link to this post

    At what exact step is index.php being added again?

    I often find that when I do a new install index.php appended to teh URL and I remove it straight away and I never see it again...

  • Pigeon
    Avatar
    Community Member
    243 Posts

    Re: index.php added to base href Link to this post

    Hmmm, do your links to the homepage go to 'index.php' or just to '/' and then you get forwarded to index.php?

    Generally this is a sign of mod_rewrite failing, but it might be your server sending you to the default file if you dont specify one... Which could be tricky to fix.

  • GibMo
    Avatar
    Community Member
    17 Posts

    Re: index.php added to base href Link to this post

    This is the url: http://www.poesenkat.nl/

    If you remove the index.php part in the url at some point everything is fine. But as soon as you click on home. It's back again.

  • simon_w
    Avatar
    Forum Moderator
    474 Posts

    Re: index.php added to base href Link to this post

    Can you try renaming index.php (on the filesystem) to something like index.php.bkp and see if it still gets added?

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: index.php added to base href Link to this post

    I think I have a related issue, see: http://www.silverstripe.org/installing-silverstripe/show/289628
    I have also just found that if I try to connect to my server from another machine on my network I can only get the site to load if I use the site path including the index.php, BUT the site loads in the broken state described in the above noted thread.

    One more test.. From the same secondary machine on my network, I try loading a v2.3x silverstripe site I have made (note the other I am testing is running 2.4.2 ). This site loads with the index.php, not without, however; it also loads index.php/about-us/ but not /about-us/

    Seems to me that any path that is using the $ThemeDir template variable is not able to load, along with the links being generated incorrectly.

  • GibMo
    Avatar
    Community Member
    17 Posts

    Re: index.php added to base href Link to this post

    Hi Simon,

    Renaming the index.php fixes the problem. But what does that tell you?
    Btw the homepage is now loading very slowly the first time

    [Update] loading times are ok now.

    But still I would like to know why renaming fixed the problem.

  • simon_w
    Avatar
    Forum Moderator
    474 Posts

    Re: index.php added to base href Link to this post

    I'm assuming your host has some module installed that caused it to try to load the index.php file, even though mod_rewrite should have been telling it not to.

    21172 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.