As you may have noticed, all Drupal URLs in the form http://WWW.drupal.org/path/to/file redirect to http://drupal.org/path/to/file (without WWW.).

I'm in the process of setting up several Drupal websites and I wonder which I should use for the domains: with or without ".www"? Why drupal.org is not www.drupal.org? Which works best in terms of SEO?

I like the shorter URLs and the fact that it forces to navigate the site via a unified URL scheme. Besides, it seems to have worked well for Drupal in terms of SEO (Homepage PR = 7/10 at the time of writing) and comments elsewhere indicate that "if the site can be accessed as either "example.com" or "www.example.com" then the search engines will split the indexing of the site between them two, splitting up the pagerank" (http://drupal.org/node/38003#comment-86406). Is that correct?



geodaniel’s picture

I suspect that most search engines will see www.site.domain and just site.domain as the same site if they have the same content, therefor allowing them both to share the same pagerank. It is possible that it would assign a different pagerank for each site (based on differing numbers of inward links, etc) but it would seem pointless, and mean that the two different URLs would potentially show up next to each other in search results for a particular term.

Without the www. certainly looks nicer, and having the www. subdomain redirecting to the main site stops search engines having to worry about if the sites are in fact different, and gives a consistent interface for users.

vincentc’s picture

Thanks for your input, geodan.

I tend to agree with you. So many websites use "WWW.", it's more a default configuration than a spamming technique, and I don't see why search engines would respond to it - some way or another.

Still, I've read many posts/articles about the co-existence of site.com and www.site.com being a bad thing in terms of SEO. I guess in the end my only question is: maybe "removing the WWW." doesn't improve search engine indexing, but can we at least say for certain that it doesn't impair it either?
(I don't see any reason why it would.)

geodaniel’s picture

I can't see any reason why removing the www would impair the ranking. I'd definately say stick to one though, if you can, instead of using both interchangably.

Param’s picture

My index Page rank with www = 4 and without www = 3 ... so maybe, the search engine does see www.site.domain and just site.domain differently !!!!

Just a thought !


Geary’s picture

If your site is showing up in Google both with and without the www., then you definitely need to redirect one to the other.

Check your incoming links to your site with and without the www. You probably have links to both versions of the URL, with more of them to the www. version.

kkaefer’s picture

See also http://no-www.org/ for further information.

Geary’s picture

It's inconceivable that the presence or absence of "www." would affect any search engine rankings.

What does matter is that you don't use both.

Pick the form you prefer and redirect the other to it with a 301 permanent redirect. You can use .htaccess for this:

</code>RewriteEngine on
RewriteCond  %{HTTP_HOST}  ^example\.com  [NC]
RewriteRule  ^/?(.*)  http://www\.example\.com/$1 [R=permanent,L]


</code>RewriteEngine on
RewriteCond  %{HTTP_HOST}  ^www\.example\.com  [NC]
RewriteRule  ^/?(.*)  http://example\.com/$1 [R=permanent,L]

In particular, if you prefer the non-www. form, it's important to allow the www. and redirect it to your preferred URL. People will type the www. URL into their address bars.

vincentc’s picture

Thanks for your input Geary.

vincentc’s picture

Just a small question, though. My webhost indicated another method to implement the redirection: he said to set up a vhost for www.example.com with the following directives:

<VirtualHost *>
        ServerName www.example.com
        RedirectMatch permanent ^(.*)$ http://example.com$1

I'm using it right now and it works perfectly. But since his syntax slightly differs from yours, I was wondering if both were okay (and what the difference between the 2 is)?

Thank you,

Geary’s picture

These are just two different ways of doing the same thing. If the code your web host gave you is doing the job, stick with it.

Coupon Code Swap’s picture

Thanks Geary. This is just what I was looking for. It is great that you can look for this kind of info on Drupal forums and find the answer :)

jt6919’s picture

I don't think www matters one way or the other either.....but I wonder if it matters in regards to linking...

what I mean is - if you have 50 inbound links that are http://site.com and 4 inbound links that are http://www.site.com - in theory your site.com listings should come up better than the www.site.com ones because you have more inbound links to them. But of course - this is only in theory.... =)

there are many other factors and things you can do to improve page rankings and search engine indexing in drupal - which is why I put together a one page guide with what I've figured out so far in regards to drupal and SEO:

J. Cohen’s picture

It doesn't matter whether you include the www or not, but there should be only one version. Redirect from one to the other with a 301 redirect.

I choose the version based on which has more inbound links. If the www version has more IBLs, which is usually the case, then I redirect to that. If it is a new site, it doesn't matter.

One of these goes in your .htaccess, below the RewriteEngine On part, replacing example.com with your domain name:

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


RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]
redvespa’s picture

I'm struggling to get this working with a multisite setup.
I have virtual host setup, and then the drupal selects the correct site using their file structure and hostname + DocumentRoot.

But if I use Rewrite in the virtual host section of apache or in the .htaccess file, I get a server not found.

Lets say I have the following
Apache stuff

<VirtualHost *>
        ServerName site1.dev
        DocumentRoot /www/drupal_install


Drupal structure

 /www/drupal_install/All drupal stuff

How do I get site1.dev AND www.site1.dev working, because as I understand it drupal need to use the host info in the url to know which site to pick?

kwood07’s picture

I have a site that has been in existence as a wordpress blog that I plan to move over to drupal. There are several inbound links to the www version of my home page and my concern is that the internal linking structure in drupal will default to the non www address - thus weakening my efforts to keep linking to the www version. Will this redirect take care of the internall drupal linking as well? The site is www.digitalmediastream.net if you want to see what I'm talking about.

Jasa Pembuatan Website’s picture

I'm still confiuse about this, with or without www.. please tell me what should i do about my http://adiproject.com ..please help me

Jaypan’s picture

Have one redirect to the other. For SEO purposes it doesn't really matter which one you choose. I prefer to use www myself.

takeonepicture’s picture

Those are just two different ways of doing the same thing.

If the code your web host gave you is doing the job, stick with it.

Always pick the best.