Tags: seo
03/21/07
How to redirect www.domain.com to domain.com
Most sites can be reached by two different URLs. For example http://b2evolution.net/about/features.html and http://www.b2evolution.net/about/features.html .
This is good for the users who can choose wether or not to type in the "www." part. However, it is not good for search engines which will tend to see a lot of duplicate contents.
If you are on an Apache webserver, you can use mod_rewrite in order to redirect all traffic that goes to the www.domain to the "non www" domain.
Try adding this to a file named ".htaccess" at the root of your site (create that file if it doesn't exist):
RewriteEngine on
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^your-domain.com [NC]
RewriteRule ^/(.*) http://your-domain.com/$1 [L,R=301]
Note: More advanced users will prefer to add this to the httpd.conf / apache2.conf instead in order to gain a little efficiency and also to not interfere with tests on development/staging servers.
Explanations
RewriteEngine on activates mod_rewrite.
The first RewriteCond makes sure we have a non(!) empty(^$) hostname to work with.
The second RewriteCond detects that the host name is not(!) the one we want (e-g: it has an extra www. part in it).
The RewriteRule sends out a permanent(301) redirection to the right domain name followed by the currently requested path/page ($1).
Handling multiple domains at once
Below is more elegant (yet complex to read) solution that can handle multiple domains at once (if you have "ServerAlias"es) and that doesn't require to type-in your domain (just copy/paste):
RewriteEngine on
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^/(.*) http://%1/$1 [L,R=301]
The trick here is to use %1 which matches the canonical part of the domain name in the second RewriteCond (.+) .
03/20/07
Sitemaps priority is confusing
When looking at the sitemaps protocol which is now endorsed by Google, Yahoo and MSN, I can't help but crying about how obscure the documentation is, especially for the <priority> element.
Please note that the priority you assign to a page is not likely to influence the position of your URLs in a search engine's result pages.
Okay, so what's the point?
Granted that setting all priorities to 1.0 will not make the urls rank higher than urls from other sites. But we're talking about position of URLs here, not sites.
Sometimes, the same site appears multiple times in search results, with different pages/urls. In that case, if priority doesn't influence which URL comes first, compared to which other comes second, then what's the use?
For example, on a blog, the same info can be found on a post's permanent url, on the homepage, on the category page, on the archives pages, the RSS feed, etc.
Sometimes the search will return several of these locations. If the priority can't be used to tell that the permanent url would be the best choice to put first, then... I don't get it! ![]()
Does it mean that priorities are only used to determine what gets crawled first? If it does, then it means that maybe the 100 top priorities will be indexed and the others won't! So the top 100 may appear in search results and the other may not!
Present vs. not present! That's what they call "not influencing the position'? ![]()
Again, if it doesn't do that, then what does it do?
All I can think of at that point is the priority being an alternative to <changefreq> : a site gets a certain number of reindexes a day, and high priorities pages will be refreshed more often that low priority pages.
That would comply with the definition of that <priority> does NOT do...
But then... it doesn't make sense with what it is *supposed* to do:
it only lets the search engines know which pages you deem most important for the crawlers.
Or by "most important", are we supposed to understand "most frequently updated"?
I really wonder who it helps to have that spec being so obscure... ![]()
03/12/07
Redirecting old posts
One of the cool things you can do with b2evolution 2.0 is redirect older posts to a new URL.
I've put this to use by redirecting some of my first English posts on fplanque.net to fplanque.com.
Here's an example: http://fplanque.net/Blog/devblog/2003/01/21/quote_of_the_day_computers_and_programme
If you click on that link you go straight to France and bounce back immediately to:
http://fplanque.com/dev/dev/computers-programmers-dangerous-match
All that automagically with a nice 301 Permanent redirect! ![]()
I have already observed in the past that Page Rank would follow 301 redirects when moving pages on the same site. I'm quite curious to see how moving posts to a different server, heck a different country, will affect the PageRank.
If all goes well, PR should follow... someday ![]()