You are invited to Log in or Register a free Frihost Account!

Non–www and www Redirect – What Method?

Sorry if this is a ridiculously stupid question, but I've been trying to find out whether or is the default on Frihost, but currently to no avail using the search function and some looking around. Also how does Frihost redirect non–www traffic to the www website (or vice versa)? Is is using a 301 redirect or using a CNAME? I ask this because I tried to look for a www folder (as both www and non–www versions of my subdomain work) in the file manager, which wasn't there. I also tried creating a www subdomain, but that only worked when I typed in
DirectAdmin creates the www subdomain as an alias of the main domain. If you go to the www or non-www version of your domain, it shows the files of the public_html directory (domains/<domain_name>/public_html). They both display the same thing.

I have no idea what exactly happens when you create the www domain yourself, but I would definitely not recommend it.

If you wish to redirect one version to the other (eg non-www to www), you can do that with a php 301 redirect or in a .htaccess file (which is what we do on the website).
Like Bondings point out the bot are default www and without www . For example: if someone come on your site with www .yoursite .frih .org and on your pages are links like http: //yoursite .frih .org then the server will automatically find right page (the gaps are for avoid to create link). You don't need to worry about it.

If you are uploading files and folders on server always upload in public_html not in www folder. The best solution is forget it. Smile

If you want to redirect all non-www requests to your site to the www version, all you need to do is add the following code to your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

This will redirect any requests to to There are several benefits from doing that:
It will avoid duplicate content in Google
It will avoid the possibility of split page rank and/or split link popularity (inbound links).
It's nicer, and more consistent.

Note that if your site has already been indexed by Google without the www, this might cause unwanted side effects, like lost of PR. I don't think this would happen, or in any case it would be a temporary issue (we are doing a permanent redirect, 301, so Google should transfer all rankings to the www version). But anyway, use at your own risk!

Something nice about the code above is that you can use it for any website, since it doesn't include the actual domain name.

Redirecting www to non-www
If you want to do the opposite, the code is very similar:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^my-domain\.com$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

In this case we are explicitly typing the domain name. Remember to change 'my-domain' with your domain name!
Related topics
Redirect Problems - 50FRIH reward
Not Voting is Reasonable for People Who Want Freedom
Need a little help
What really is the difference between matter and energy?
Detecting Nerve Signals
Google doesn't track my Web page..what shall i do ?
Cant Delete Thumbs (Windows 7)
Why I quit wasting my time with Creationists
static keyword in PHP
Master Tutorial on SEO
phpBB - Installation Tutorial
Problem with email through Thunderbird
session not working behind router
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Frihost Support

© 2005-2011 Frihost, forums powered by phpBB.