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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

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

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

multiple sites, internal rewrite, getting rid of subdir


Go to End


3 Posts   2253 Views

Avatar
mathiasp

Community Member, 12 Posts

14 February 2009 at 3:12am

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

Community Member, 12 Posts

14 February 2009 at 3:12am

Oh well, to answer my own question:

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

does it.

Avatar
mathiasp

Community Member, 12 Posts

14 February 2009 at 3:23am

Edited: 14/02/2009 3:27am

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 ?