Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

index.php added to base href

Go to End

12 Posts   24782 Views


Community Member, 17 Posts

7 October 2010 at 6:08am

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


<Files *.ss>
Order deny,allow
Deny from all
Allow from

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

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


Forum Moderator, 1899 Posts

7 October 2010 at 8:11am

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...


Community Member, 253 Posts

7 October 2010 at 10:29am

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.


Community Member, 17 Posts

7 October 2010 at 12:52pm

This is the url:

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.


Community Member, 473 Posts

7 October 2010 at 1:28pm

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


Community Member, 178 Posts

7 October 2010 at 2:05pm

Edited: 07/10/2010 2:24pm

I think I have a related issue, see:
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.


Community Member, 17 Posts

7 October 2010 at 7:57pm

Edited: 08/10/2010 7:37am

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.


Community Member, 473 Posts

8 October 2010 at 7:42am

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.

Go to Top