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.

Installing SilverStripe

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

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

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


Go to End
Reply

9 Posts   4685 Views

Avatar
Garrett

31 March 2010 at 4:30am (Last edited: 31 March 2010 4:38am), Community Member, 245 Posts

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

31 March 2010 at 7:42pm Forum Moderator, 5511 Posts

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

1 April 2010 at 6:30am Community Member, 245 Posts

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

6 January 2011 at 10:55am Community Member, 178 Posts

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

27 October 2013 at 1:43pm (Last edited: 31 October 2013 3:42am), Community Member, 15 Posts

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

3 December 2013 at 5:27am Community Member, 395 Posts

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

19 December 2013 at 10:35am Community Member, 135 Posts

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

Avatar
mcbmcb0

18 February 2014 at 10:14pm (Last edited: 18 February 2014 10:30pm), Community Member, 4 Posts

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