Redirecting Webfaction Subdomain to AWS

I just started playing around with AWS. I have a domain name that is served by Webfaction. I wanted to create a subdomain and point it at my AWS EC2 instance. Seems like it should be pretty easy. But the time it takes for domain name propagation makes makes it hard to debug.

The first thing to note is the command:


lets you know if propagation has been done.


The first approach I tried was to set the CNAME for the subdomain using the Webfaction control panel. The was super easy, but it did not work. It appears AWS will not allow that. For more info, see here.


The other approach is to create a static site on Webfaction and use .htaccess to redirect. Something like this. One advantage of this approach is once the domain name has propogated, you do not need to wait for it to re-propagate if you change .htaccess.

If you get a 500 error, you can inspect the Webfaction logs to find out what went wrong. The log you want is ~/logs/apache/error_my_app_php.log.

Here is the htaccess file that worked for me:

Redirect permanent /
order deny,allow






Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s