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

Redirect domain to specific URL


Go to End


8 Posts   1761 Views

Avatar
dendeffe

Community Member, 135 Posts

11 November 2011 at 9:15pm

I need to redirect a parked domain (www.tuinlabo-natuurlijkkunstgras.be) to redirect to a url on the main domain (tuinlabo.be/trends).

I think the general SilverStripe .htaccess ruls might be getting in the way of this happening. Any ideas?

Avatar
MarcusDalgren

Community Member, 288 Posts

11 November 2011 at 10:37pm

So just to clarify, you're not actually running a SS install on the parked domain right? If not then SS really can't interfere with the redirect FROM the parked domain to the main domain. What happens when you reach tuinlabo.be/trends (if it's a SS install) might be another matter.

Avatar
dendeffe

Community Member, 135 Posts

11 November 2011 at 11:01pm

Edited: 11/11/2011 11:01pm

Smurkas, the domain is parked on cPanel (http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/ParkedDomains) So, www.tuinlabo-natuurlijkkunstgras.be and tuinlabo.be are the same server (running SS).

Avatar
MarcusDalgren

Community Member, 288 Posts

11 November 2011 at 11:15pm

Oh I see. You can do a redirect of a parked domain directly in cPanel if I remember correctly. Have you tried that?
If that doesn't work you'll have to put in an extra rewrite rule that checks the domain and redirects to the right one in the SS .htaccess file.

Avatar
dendeffe

Community Member, 135 Posts

11 November 2011 at 11:38pm

When I add the redirect in cPanel, this gets added in .htaccess (after the SilverStripe stuff):

RewriteCond %{HTTP_HOST} ^tuinlabo\-natuurlijkkunstgras\.be$ [OR]
RewriteCond %{HTTP_HOST} ^www\.tuinlabo\-natuurlijkkunstgras\.be$
RewriteRule ^/?$ "http\:\/\/tuinlabo\.be\/trends" [R=301,L]

But it does no redirection.

Avatar
MarcusDalgren

Community Member, 288 Posts

11 November 2011 at 11:58pm

Well that's because it's AFTER the SilverStripe stuff so it never matches. You need to put it before the SilverStripe stuff so that it's the first rule that gets tested.

Avatar
dendeffe

Community Member, 135 Posts

12 November 2011 at 12:00am

Yup, that was it. Thanks for the help.

Avatar
MarcusDalgren

Community Member, 288 Posts

12 November 2011 at 12:04am

No prob mate, that .htaccess stuff can be really tricky.