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

One website, two domain names?


Go to End


4 Posts   1827 Views

Avatar
bones

Community Member, 110 Posts

3 September 2009 at 8:20pm

I have a website which is split into two, as there are two distinct parts of the business. I would like each to have its own domain name. The second domain name is parked on the server, so whether a visitor enters www.domain1.com or www.domain2.com, they are directed to the "normal" homepage.

I would like users entering www.domain1.com to continue to go to the "normal" homepage, and users entering www.domain2.com to go to /domain2/

I had thought that this would be a simple case of putting a 301 redirect on the server, but that doesn't work for some reason.

My host has suggested .htaccess rewrites, but I don't know if this would work (and have no idea how to do it anyway).

Can anybody help me, please?

Avatar
bones

Community Member, 110 Posts

9 September 2009 at 8:41pm

My host has been looking into this for me too, but we still have no answers. Can anybody help, please?

Thanks

Avatar
Willr

Forum Moderator, 5523 Posts

9 September 2009 at 8:51pm

Maybe something like

RewriteCond %{HTTP_HOST} ^www.domain2.com$ [NC]
RewriteRule ^(.*)$ http://www.domain1.com/domain2/$1 [R=301,L]

That will redirect everything from domain2 to that bottom url using a 301.

Avatar
bones

Community Member, 110 Posts

10 September 2009 at 8:32pm

Thanks for your reply.

Unfortunately, my host and I have tried that and it doesn't work.

In their words: "I tried adding rewrites to your .htaccess but it follows that if your redirecting the root to a subfolder, and your parking a domain onto the route, the parked domain will point to the same place as the main domain."

Is there any other way around this?

Thanks