Jump to:

23370 Posts in 18145 Topics by 2864 members

General Questions

SilverStripe Forums » General Questions » silent redirect to silverstripe/ folder

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

Page: 1
Go to End
Author Topic: 3242 Views
  • markotondria
    Avatar
    Community Member
    13 Posts

    silent redirect to silverstripe/ folder Link to this post

    halloo..

    I developed a site in mydomain.com/SilverStripe, but have my own custom index.php file that 'is' the whole site..
    Now the site is ready for public viewing, I need visitors to 'mydomain.com' to be silently directed to mydomain.com/SilverStripe/index.php..

    At the moment I have a simple meta redirect on the mydomain.com/index.html page, but of course, would like to do some mod-rewrite/htaccess stuff to make the silent redirection.

    My htaccess file that lives in the /SilverStripe/ folder has a RewriteBase of /SilverStripe already..

    Any clever apache type folks out there know the easy answer ?

    Thank u !

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: silent redirect to silverstripe/ folder Link to this post

    Could you not just remove the index.php that was the whole site?

  • PGiessler
    Avatar
    Community Member
    47 Posts

    Re: silent redirect to silverstripe/ folder Link to this post

    There is an attribute, called LegacyURL which you can redirect to a URL. You have to in the SilverStripe documentation.

    Best regards,

    Pascal

  • banal
    Avatar
    Community Member
    901 Posts

    Re: silent redirect to silverstripe/ folder Link to this post

    You could place a .htaccess file with the following content in your web-root:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$

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

    This would route the requests to the SilverStripe/sapphire/main.php..
    There might be other things that need to be fixed though. I can imagine the base url of the SilverStripe site won't be generated correctly and then you would have to rewrite asset paths as well

    3242 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.