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

multiple sites, internal rewrite, getting rid of subdir


Reply

3 Posts   1322 Views

Avatar
mathiasp

14 February 2009 at 3:12am Community Member, 12 Posts

I have installed two copies of silverstripe in a hosted account. My main .htaccess file has rewrite rules like:

RewriteCond %{HTTP_HOST} ^(www\.)?somesite\..* [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteCond %{REQUEST_URI} !^/cms.somesite/
RewriteRule (.*) /cms.somesite/$1 [L]
#
RewriteCond %{HTTP_HOST} ^(www\.)?othersite\..*
RewriteCond %{REQUEST_URI} !^/cms.othersite/
RewriteRule (.*) /cms.othersite/$1 [L]

This works fine, only all links point to the subdirs (e.g. http://somesite.net/cms.somesite/about-us/)

How can I teach silverstripe to generate links to http://somesite/about-us/ ?

I think it could be done in the main silverstripe .htaccess rewrite rules, but I'd rather not touch that. Is there
some way to force a base url?

thanks, Mathias

Avatar
mathiasp

14 February 2009 at 3:12am Community Member, 12 Posts

Oh well, to answer my own question:

Director::setBaseURL("http://somesite.com/);

does it.

Avatar
mathiasp

14 February 2009 at 3:23am (Last edited: 14 February 2009 3:27am), Community Member, 12 Posts

Well, well, well...
not quite a working solution.

Login no longer works, the login page just comes up again, no error msg at all.
I have to go to http://somesite.com/cms.somesite/Security/login for a working login,
and use http://somesite.com/cms.somesite/admin as cms url; and this doesn't work
since setBaseURL make all links to http://somesite.com/[admin_section], which
leads me to the login page again even if logged in.

Any idea how to get login to work on http://somesite.com/Security/login ?