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.

General Questions /

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

silent redirect to silverstripe/ folder


Reply


4 Posts   3340 Views

Avatar
markotondria

Community Member, 13 Posts

15 May 2009 at 3:39am

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 !

Avatar
martimiz

Forum Moderator, 1132 Posts

15 May 2009 at 9:42pm

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

Avatar
PGiessler

Community Member, 47 Posts

15 May 2009 at 11:16pm

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

Best regards,

Pascal

Avatar
banal

Community Member, 901 Posts

16 May 2009 at 9:09pm

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