login community faq

Hi,

I currently have 2 domains that refer to the same Rails app.

e.g.

www.domain.com www.domain.co.uk

Currently I've configured them so that they both point to the same Rails application. However I would like to change the behaviour so that anyone that types the .co.uk domain is redirected to domain.com so it's more seamless.

How can I do this in the Webfaction panel?

Thanks.

asked May 29 '12 at 00:55

lanfeo's gravatar image

lanfeo
1


There isn't a way to do this directly from the Control Panel; instead, you would create a simple Static/CGI/PHP application which exists solely to redirect traffic to the other domain. This is discussed in our documentation here.

In a nutshell, you'll create a new application so that you have two instead of one. The second application, named something like redirect, exists with a .htaccess file and redirects incoming requests back to www.domain.com. Then you point www.domain.co.uk (and any other domains which you want to redirect) at the second redirect application, leaving only www.domain.com pointing at the real application.

Hope that helps!

answered May 29 '12 at 01:06

ryans's gravatar image

ryans ♦♦
29361420

That seems awfully complicated. Any reason for not just putting

1
Redirect 301 / http://www.example.com/

in .htaccess?

(Jun 22 '12 at 16:37) Donatzsky Donatzsky's gravatar image

That would only redirect "/" - it wouldn't redirect other URLs and it won't preserve query parameters.

(Jun 22 '12 at 17:33) seanf ♦♦ seanf's gravatar image

Well, it works for me. Try going to depanordique.com/<what-ever> and see what happens.

(Jun 23 '12 at 05:48) Donatzsky Donatzsky's gravatar image

You are correct - "Redirect 301 / http://www.example.com/" would work. There are scenarios though where you need to use mod_rewrite instead, and there are scenarios where you'd need to use a separate application. That's the most universal method - that's why it's in our docs.

(Jun 23 '12 at 06:38) todork todork's gravatar image
Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited