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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   26197 Views

Avatar
GibMo

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

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

Avatar
swaiba

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

Avatar
dhensby

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.

Avatar
GibMo

Community Member, 17 Posts

7 October 2010 at 12:52pm


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.

Avatar
(deleted)

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?

Avatar
DsX

Community Member, 178 Posts

7 October 2010 at 2:05pm

Edited: 07/10/2010 2:24pm

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.

Avatar
GibMo

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.

Avatar
(deleted)

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