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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Alias a new domain name to a path on an existing SilverStripe site


Go to End


3 Posts   1029 Views

Avatar
Sygmoral

Community Member, 46 Posts

16 December 2015 at 3:55am

Edited: 16/12/2015 3:56am

I installed a blog on existing.com/blog, but now they want that blog to show up on the root of newdomain.com (while keeping the main website on existing.com).

I imagine I can alias that new domain name to the old one, but how then can I tell SilverStripe to load the blog page when the request is coming for newdomain.com? (while of course also keeping all the links working, if they click links to blog posts etc)

Or will I have to set up the blog in a different way? Subsites or someting? I do want it in the same CMS though.

Avatar
Devlin

Community Member, 344 Posts

17 December 2015 at 9:42pm

Maybe a little custom script. Curl the contents of existing.com/blog, rewrite the links as necessary and cache it.

Though, you'll create duplicated content which will probably do you no good.

Avatar
Sygmoral

Community Member, 46 Posts

18 December 2015 at 5:47pm

Thank you for your suggestion. Here's what I ended up doing, for future searchers.

I left the path /blog/ on the new domain after all - so newdomain.com will redirect to newdomain.com/blog. That way I can just alias both domains, which always works, and I don't need to curl contents or rewrite links. All that was left is a little custom logic in the HomePage to redirect newdomain.com/ straight to the blog, and extending Blog in order to redirect existing.com/blog to newdomain.com/blog.

I actually thought about "hiding" the /blog/ component in all the links by overriding Blog and BlogPost's Link method, and then calling the Blog content from the HomePage, but decided not to fuss with it to avoid breaking anything. It's undoubtedly possible though, and that would be a full solution to my original issue. (With the side effect that the whole original website is available on that new domain too (except for the homepage), but that doesn't really hurt).