Jump to:

4952 Posts in 14417 Topics by 1491 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » "/index.php/" Being Appended to <% base_tag %>

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

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

Page: 1 2
Go to End
Author Topic: 4266 Views
  • Garrett
    Avatar
    Community Member
    245 Posts

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

    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,

    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

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: "/index.php/" Being Appended to <% base_tag %> Link to this post

    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?

  • Garrett
    Avatar
    Community Member
    245 Posts

    Re: "/index.php/" Being Appended to <% base_tag %> Link to this post

    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

    Attached Files
  • DsX
    Avatar
    Community Member
    178 Posts

    Re: "/index.php/" Being Appended to <% base_tag %> Link to this post

    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.

  • Spambanjo
    Avatar
    Community Member
    15 Posts

    Re: "/index.php/" Being Appended to <% base_tag %> Link to this post

    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())) ;

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: "/index.php/" Being Appended to <% base_tag %> Link to this post

    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.

  • Nobrainer Web
    Avatar
    Community Member
    134 Posts

    Re: "/index.php/" Being Appended to <% base_tag %> Link to this post

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

  • mcbmcb0
    Avatar
    Community Member
    4 Posts

    Re: "/index.php/" Being Appended to <% base_tag %> Link to this post

    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

    4266 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.