WebFaction
Community site: login faq
How do I redirect a url from domain.com to www.domain.com?
I was somewhat astonished this wasn't happening automatically.

I've followed the steps in http://forum.webfaction.com/viewtopic.php?id=4230
except that I've used the following .htaccess (in webapps/redirect):
    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC]

Mod-Rewrite also appears to be enabled (in webapps/django/apache2/conf/httpd.conf):
    LoadModule rewrite_module    modules/mod_rewrite.so

However nothing seems to be having any effect.

Thanks
Rick

asked 15 Dec '10, 21:18

Rick
113
accept rate: 0%

edited 15 Dec '10, 21:20


Hi Rick,

It looks like your rules are correct, it looks like you may not have mounted the Static/CGI/PHP application at the root of the domain.com as shown here:

http://docs.webfaction.com/software/static.html?highlight=redirect#redirect-a-domain-with-a-static-cgi-php-app

permanent link

answered 15 Dec '10, 21:25

klynton
1.6k1210
accept rate: 41%

Thanks klynton, but webapps/redirect is the correct directory according to that link (my Static/CGI/PHP app is called 'redirect').

In the webfaction control panel I have a website entry called 'redirects' which maps subdomain *.domain.com onto the redirect app (URL path is '/'). 'www.domain.com' works as a url as do a few other defined urls, but anything else such as 'domain.com' and 'blah.domain.com' takes me to the 'WebFaction - Coming soon...' default page.

(23 Dec '10, 19:28) Rick

Working with wildcard domains in this way may not work as you would expect them to. Can you submit a support ticket so we can look at it further?

(23 Dec '10, 19:37) klynton

Solved - I'd missed the obvious that *.domain.com does not cover domain.com.

permanent link

answered 27 Dec '10, 16:32

Rick
113
accept rate: 0%

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:

×76
×75
×10
×1

question asked: 15 Dec '10, 21:18

question was seen: 5,642 times

last updated: 27 Dec '10, 16:32

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