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.

General Questions

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

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

Redirect domain to specific URL


Reply

8 Posts   1002 Views

Avatar
dendeffe

11 November 2011 at 9:15pm Community Member, 135 Posts

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

11 November 2011 at 10:37pm Community Member, 288 Posts

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

11 November 2011 at 11:01pm (Last edited: 11 November 2011 11:01pm), Community Member, 135 Posts

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

11 November 2011 at 11:15pm Community Member, 288 Posts

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

11 November 2011 at 11:38pm Community Member, 135 Posts

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

11 November 2011 at 11:58pm Community Member, 288 Posts

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

12 November 2011 at 12:00am Community Member, 135 Posts

Yup, that was it. Thanks for the help.

Avatar
MarcusDalgren

12 November 2011 at 12:04am Community Member, 288 Posts

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