Jump to:

4571 Posts in 1382 Topics by 1376 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, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1929 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
    5163 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
    172 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.

    1929 Views
Page: 1
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.