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.

General Questions

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

index.php added to base href


Go to End
Reply

12 Posts   21189 Views

Avatar
GibMo

7 October 2010 at 6:08am Community Member, 17 Posts

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

7 October 2010 at 8:11am Forum Moderator, 1796 Posts

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
Pigeon

7 October 2010 at 10:29am Community Member, 243 Posts

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

7 October 2010 at 12:52pm Community Member, 17 Posts

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
simon_w

7 October 2010 at 1:28pm Forum Moderator, 474 Posts

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

Avatar
DsX

7 October 2010 at 2:05pm (Last edited: 7 October 2010 2:24pm), Community Member, 178 Posts

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

7 October 2010 at 7:57pm (Last edited: 8 October 2010 7:37am), Community Member, 17 Posts

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
simon_w

8 October 2010 at 7:42am Forum Moderator, 474 Posts

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