Community site: login faq

I have a mod_wsgi 3.4/Python 2.7 (port 27931) app set up for a client under the domain richkalonick.com. He would like www.richkalonick.com to work as well.

In the admin panel I've clicked "Domains/Websites", then clicked "Domains". Under the domain richkalonick.com I have richkalonick.com and www.richkalonick.com listed. When I click "Websites" under my app "richkphoto" I have 3 domains listed:

  • http://richkphoto.com
  • http://richkalonick.com
  • http://www.richkalonick.com

When I do ping richkphoto.com I get the following

? ~ ping richkalonick.com PING richkalonick.com ( 56 data bytes 64 bytes from icmp_seq=0 ttl=54 time=32.669 ms 64 bytes from icmp_seq=1 ttl=54 time=78.347 ms ^C --- richkalonick.com ping statistics --- 2 packets transmitted, 2 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 32.669/55.508/78.347/22.839 ms When I ping the www domain I get the following:

? ~ ping www.richkalonick.com PING ns1.webfaction.com ( 56 data bytes 64 bytes from icmp_seq=0 ttl=54 time=89.119 ms 64 bytes from icmp_seq=1 ttl=54 time=310.602 ms ^C --- ns1.webfaction.com ping statistics --- 2 packets transmitted, 2 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 89.119/199.861/310.602/110.741 ms

So you see it looks like the www version is hitting webfaction, it's just not loading my app for some reason. Could anyone offer some suggestions as to what's going on?

asked 15 Aug '13, 22:24

accept rate: 0%

www is a subdomain just like any other sub.example.com link. It's not some ubiquitous web site prefix as is commonly thought.

What you need to do is set up a 301 redirect application for www links. Here's my setup:

Application name: www301
Type: Static/CGI/PHP-5.4

Website name: www301
Served by application: www301

The application contains a single file under ~/webapps/www301. It is .htaccess containing the following:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all

ALL domains I use which I want www.example.com to work with I assign to the www301 web site. What this does is every time someone goes or is directed to one of my domains with a www prefix it returns a permanent redirect to example.com. This is fairly transparent to the user other than the fact that the www. part disappears from the address bar.

It's important to do it this way instead of assigning www.example.com and example.com to the same app if you're interested in search rankings. If www.example.com and example.com are just assigned to the same app than Google and other search engines will see it as two different web sites with two different search rankings. This punishes your search rankings by splitting them up. By issuing a 301 redirect, every time someone visits your site via www.example.com, the 301 error tells Google "www.example.com does not exist, the domain you should be indexing is example.com" keeping all of your statistics under the same domain listing.

permanent link

answered 18 Aug '13, 22:18

accept rate: 8%

edited 18 Aug '13, 22:19

I think I understand. This is what I did:

1) Created a new application as you suggested, called www301. 2) Created a new website called wwwRK. The domain for this is www.richkalonick.com and it is served by the www301 application.

If that's correct, you're saying that I should be able to hit www.richkalonick.com and be redirected to richkalonick.com? I've saved the settings and now I'm just binding my time for Webfaction's DNS to update. If it works I'll let you know.

(19 Aug '13, 22:48) commadelimited

You have to make the .htaccess file in the www301 web app directory, otherwise you have nothing declaring the actual redirect.

But yeah, that's pretty much it.

(20 Aug '13, 00:32) HittingSmoke

Oops. Sorry, I did that step as you indicated. Still isn't working.

(20 Aug '13, 07:02) commadelimited

It looks like the domain isn't resolving to the web server but it's stopping at the nameserver level. That would indicate the domain isn't properly added to an application.

You might want to put in a support ticket so they can look at your account and see what's not properly configured.

(20 Aug '13, 13:42) HittingSmoke

You've got some mixed information there, such as what you say you're pinging and what the ping results show, but I think what you're saying is your www.richkalonick.com domain is not loading your site. This would indeed be consistent with your ping results, which show it not pointing to your WebFaction server. This would be because your domain is not using WebFaction's DNS servers, so you will have to create another DNS A record with your DNS provider to point the www. subdomain also to your WebFaction server's IP address,

permanent link

answered 16 Aug '13, 00:53

accept rate: 27%

The problem here is that you're using external DNS and have created a CNAME record pointing www.richkalonick.com at ns1.webfaction.com:

$ dig +short NS richkalonick.com

$ dig +short CNAME www.richkalonick.com

This means that requests for www.richkalonick.com are going to our ns1 name server instead of to your web server.

To fix this, delete your CNAME record and instead create an A record to point it at your shared server IP address, just as you've done for the root domain richkalonick.com. You'll need to make these changes via your domain registrar, since you're managing your DNS with them.

permanent link

answered 20 Aug '13, 16:15

accept rate: 37%

why not have the setting in Apache config that any site that is created of the form EXAMPLE.COM is automatically reachable via either with a www or without. This way we only need to create one domain? Many hosting companies do this.

permanent link

answered 09 Dec '13, 22:04

accept rate: 0%

Because that is bad for search impressions. Google will be indexing what it believes are two entirely different sites with different search rankings depending on what people are posting as links to your site around the web, splitting your ranking between the domains which will keep each domain lower in search results.

If one uses a 301 redirect then Google sees the 301 and says "Oh, www.example.com is the same as example.com, so we'll index them as one site" which will keep your site properly indexed and ranked.

(09 Dec '13, 22:07) HittingSmoke

I see your point. I would like to use your www301 method but i don't fully understand how to implement it.

(09 Dec '13, 22:11) baba

Check out the add application/website menus in your control panel. If you start poking around you should find the options I've mentioned pretty quickly and if you get hung up at any specific step come back and I'll help out.

(09 Dec '13, 22:14) HittingSmoke

hi thnx. i managed to create the pieces:

www301 Domains Apps

This website has no domains attached. www301 (Static/CGI/PHP on /)

and i added the .htaccess file in the www301 web app directory.

i have a website with two domains www.site.com and site.com and they already have a static app assigned to them. do i also assign the www301 app to those domains?

(09 Dec '13, 22:21) baba

hi thnx. i managed to create the pieces:

www301 Domains Apps

This website has one domains attached. www301 (Static/CGI/PHP on /)

and i added the .htaccess file in the www301 web app directory.

i have a website with two domains www.site.com and site.com and they already have a static app assigned to them. do i also assign the www301 app to those domains?

(09 Dec '13, 22:22) baba

Just to be clear, I'm going to use the Webfaction control panel terms. The "app" is the application. The "web site" is the web site entry in the control panel to which the application and any number of domains are added.

Your example.com domain remains where it is. Don't touch that one. The only thing you need to do if you have the app and the web site set up properly is to take www.example.com from the web site example.com is pointed to and set it to the www301 web site.

The actual changes won't happen immediately, but it won't take long. After it's working you'll notice that if you go to www.example.com then it will just change to example.com instantly when the page starts to load.

(09 Dec '13, 22:27) HittingSmoke

hmm i don't quite follow. as i am just starting out and have nothing really set up do you mind logging in and setting the cp stuff up? ping me and i can provide the password .

(09 Dec '13, 22:38) baba

Sorry, can't do that. I don't work for webfaction and there are liability issues. However if you submit a ticket and reference this post I'm sure someone at Webfaction will be able to help you. Their support is fantastic.

(09 Dec '13, 22:54) HittingSmoke
showing 5 of 8 show 3 more comments

trying to figure it out - i have this setup

babaleo.com babaleo.com Website: Babaleo
www.babaleo.com Website: Babaleo

when you say "take" do you mean remove? e.g. remove www.babaleo.com as a Website and then add the www301 app to babaleo.com? s that it has two apps associated with it: Static and www301?

permanent link

answered 09 Dec '13, 22:53

accept rate: 0%

First of all, make sure you have the www301 app created here as per the instructions: https://my.webfaction.com/applications

REMOVE www.babaleo.com from all web sites.

Then make sure you have the www301 site created here: https://my.webfaction.com/websites

Under the settings for the www301 WEB SITE entry above, add www.babaleo.com as the domain and www301 as the app.

That should be all you need to do as long as you've create the .htaccess file under ~/webapps/www301

(09 Dec '13, 22:58) HittingSmoke

thank-you for your help: i have the following now:

www301 Domains Apps Web368 http://www.babaleo.com www301 (Static/CGI/PHP on /)

If this is correct would I in the future simply create a new website.com and then add www.website.com domain to the www301 website?

permanent link

answered 09 Dec '13, 23:32

accept rate: 0%

Correct. ANY domain added to the www301 web site which starts with www. will be rewritten to remove the www. portion so it's a universal web app you can use for all of your domains. As long as the base domain points to a web site, that's where you will end up.

(09 Dec '13, 23:34) HittingSmoke

Cool! Now the website lists is more logicall Many thanks for your help it's now working!

(09 Dec '13, 23:36) baba

Glad I could help. Enjoy :)

(09 Dec '13, 23:36) HittingSmoke

I have another r question. Will i be able to use the www301app to solve this issue: i have setup. xyz.com / www.xyz.com and i have these redirecting to a sub-domain called city.eyz.com . This latter domain is the one that has the Apps associated with it . how do i redirect the xyz.com www.xyz to go to city.xyz.com?

(19 Dec '13, 23:04) baba
Your answer
toggle preview

Follow this question

By Email:

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



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:


question asked: 15 Aug '13, 22:24

question was seen: 8,607 times

last updated: 19 Dec '13, 23:04