WebFaction
Community site: login faq

I was looking at other postings to find the simplest way to redirect all my domains to my One True Domain. All are hosted by webfaction and owned by me.

One suggestion was to place the following in a top-level .htaccess file:

      Redirect 301 http://OneTrueDomain.com

But this does not work in my hands. After I do this, I get a 500 error for OneTrueDomain.com and the other domains do not redirect.

(The reason I want to do this is that my other domains are expected misspellings of my One True Domain.)

Thanks, -H.

asked 09 Oct '11, 19:14

hopfrog
3113
accept rate: 0%

edited 09 Oct '11, 20:06


"Redirect a Domain with a Static/CGI/PHP App" is the simplest way to redirect your web traffic at our end, but it only works for web traffic.

For email, you'll either need to:

  • Create individual email address on the bad domains that forward to the corresponding address on the good domain, or
  • Create catch-all addresses on the bad domains that auto-respond to let the sender know they sent mail to the wrong domain, or
  • Create catch-all addresses that target a script that figures out the intended recipient (eg, by getting the first part of the address from the Delivered-To header, and then constructing the correct address from that).

Of those three options, the first one is the most bulletproof, the second is the easiest, and the third is the most fun to implement - if you like writing scripts :)

Hope that helps!

permanent link

answered 09 Oct '11, 19:59

seanf
12.2k41836
accept rate: 37%

Hi,

Clueless newbie again, here. I cannot get the domain redirection to work. I am sure I am doing something wrong -- but what?

  • Under Control Panel>Domains/Websites>Applications, I created a Static/CGI/PHP-5.3 app called my_redirect. As a result, there is a ~/webapps/my_redirect directory, in which there is an index.html and a new .htaccess file I created with the following contents:


Options +FollowSymLinks

RewriteBase /my_redirect

RewriteEngine on

RewriteCond %{HTTP_HOST} ^hostname.biz$ [NC]

RewriteRule ^(.*)$ http://hostname.com/$1 [R=301,L]


(where of course "hostname" is the hostname in question; I'm trying to redirect the .biz URL to the .com site). Also, there are no blank lines in the file, but if I eliminate them in my comment, there are no line-breaks. :-(

  • Now, in Control Panel>Domains/Websites>Websites, I have created a website called hostname_biz for the hostname.biz domain. I have set up a single app for it: my_redirect, and have set the URL path to /my_redirect.

When I try to browse to hostname_biz, I get a "Not found" error. (The same thing happens if I omit the RewriteBase line, or set it just to '/'.)

(09 Oct '11, 21:57) hopfrog

You should be able to remove the RewriteBase line and also remove the RewriteCond line, and then just point the other domains to the my_redirect application. You would be pointing, for example, the "hostname.biz" domain to the single "my_redirect" app. However, the URL Path would still be "/", because you want the root of the domain to redirect. (Otherwise, visitors would need to visit http://hostname.biz/my_redirect/ in order to be redirected)

(09 Oct '11, 22:49) ryans ♦♦

That makes sense; but as I said, I was still getting the "not found" error without the RewriteBase line.

I understand the reasoning behind the RewriteCond removal; but in any case, removing it does not make the redirection work.

That is, my .htaccess file now looks like the following, and I am still getting a Not Found error when I browse to hostname.biz.


Options +FollowSymLinks

RewriteEngine on

RewriteRule ^(.*)$ http://hostname.com/$1 [R=301,L]


(09 Oct '11, 23:02) hopfrog

It looks like you're still using a URL Path. Again, you need to mount the redirect application with a URL Path of /, and not /my_redirect.

(09 Oct '11, 23:10) ryans ♦♦

Thanks much -- I misunderstood you before. Actually it was the website (not an app) that had to be mounted with a URL path of /. When I did that, it worked. Many thanks, really.

(09 Oct '11, 23:42) hopfrog
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×128
×5

question asked: 09 Oct '11, 19:14

question was seen: 14,742 times

last updated: 09 Oct '11, 23:42

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM