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:

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

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

"/index.php/" Being Appended to <% base_tag %>


Go to End


9 Posts   11700 Views

Avatar
Garrett

Community Member, 245 Posts

31 March 2010 at 4:30am

Edited: 31/03/2010 4:38am

For some reason, "/index.php/" is being appended to the SS <% base_tag %>, causing the base href, and hence all the URLs, to be funky, as below:

<base href="http://www.mysite.com/index.php/" />

For example,

http://www.mysite.com/about-us/ is http://www.mysite.com/index.php/about-us/

Obviously, there is no "index.php" folder or page on the site. I've seen this on a few other implementations I've done, and have never been able to figure it out. But since it varies from machine to machine, I have no choice but to think this is some sort of PHP or Apache configuration issue. I have mod_rewrite enabled. What is the issue here?

Thanks,
Garrett

Avatar
Willr

Forum Moderator, 5523 Posts

31 March 2010 at 7:42pm

A url like http://www.mysite.com/index.php/about-us/ would mean that mod_rewrite has not been detected or is not enabled. Could you post the content of your .htaccess file. Is this a new site or an existing site thats suddenly doing this?

Avatar
Garrett

Community Member, 245 Posts

1 April 2010 at 6:30am

Yes, it does seem like a mod_rewrite issue. I never changed my .htaccess file (I think it's pretty much canned SS), but I DID move from Wampserver to my default Apache/PHP install for serving the site(s) [it's happening on All the sites]. I'm running Apache 2.0.63 and PHP 5.2.5. Below is my .htaccess code:


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

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /horngroup-prod

RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$) 

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

I have attached my php.ini and httpd.conf files.

Thanks for your help,
Garrett

Avatar
DsX

Community Member, 178 Posts

6 January 2011 at 10:55am

My solution to this problem was to add:

Director::setBaseURL('/');

to my config.

BEWARE, if moving your install to another directory, this must be updated, has caused me a large headache.

Avatar
Spambanjo

Community Member, 24 Posts

27 October 2013 at 1:43pm

Edited: 31/10/2013 3:42am

Sorry to revive an old thread but I wanted to post my solution as this has bugged me twice before, but this third time I could not fix it and had to settle for a workaround.

I could not simply set the base url to a forwardslash as my applications are developed in subfolders and then uploaded to a root directory on the server, I really did not want to compromise the convenience of this.

I simply added this to the main config.php to remove index.php from the baseURL all together.

Director::setBaseURL(str_replace("index.php/","",Director::baseURL())) ;

Avatar
Nivanka

Community Member, 400 Posts

3 December 2013 at 5:27am

with godaddy hosting this happened to me several times, and i used.

Director::setBaseURL('/');

my problem was even worse as none of the Requirements were linked correctly.

Avatar
Nobrainer Web

Community Member, 138 Posts

19 December 2013 at 10:35am

If i remember correctly, also just removing the index.php file will also work on some hosts.

Avatar
mcbmcb0

Community Member, 4 Posts

18 February 2014 at 10:14pm

Edited: 18/02/2014 10:30pm

these solutions also helped with a failing fresh install of 3.1.2 on win-7-64 XAMPP, as per: http://www.silverstripe.org/installing-silverstripe/show/38051

Go to Top