|
|
Question : SEO: htaccess and Yahoo linkdomain
|
|
I placed the following in an htaccess file for the site www.journey-book.com:
RewriteEngine on RewriteCond %{HTTP_HOST} ^journey-book\.com [NC] RewriteRule ^(.*)$ http://www.journey-book.com/$1 [R=301,L]
It seems to be correctly redirecting journey-book.com to www.journey-book.com
However, if I type in linkdomain:www.journey-book.com into Yahoo, the results are different than when I type in linkdomain:journey-book.com.
Does it take a certain amount of time for the change to take effect, or what else is happeniing?
|
Answer : SEO: htaccess and Yahoo linkdomain
|
|
Hey Bob,
I've done my best to put together a resource, or "brief overview" for you. Enjoy.
Possibilities:
- The first possibility -
1. DNS (BIND) / Apache Configuration (Single VirtualHost)
Create a CNAME for the primary domain (mydomain.com), and an A record for the secondary www (www.mydomain.com). This connects the subdomain (www) to the actual domain.
Note: From a DNS perspective, www.mydomain.com, or the www portion is really only a subdomain of mydomain.com. As such they are considered seperate entities.
Once the DNS configurations have been completed, you add an VirtualHost in httpd.conf that would look similar to this:
#80 being the port of your apache server ServerName mydomain.com DocumentRoot /home/%uname/www ServerAlias www.mydomain.com ...
Now, if an internet user or a spider connects to either mydomain.com or www.mydomain.com they will be directed to the same page.
One problem with this method is that the URL address in your browser will not change although both will result in a HTTP 200 OK response. Spiders will treat mydomain.com and www.mydomain.com as seperate sites. This makes it important to specifically use the www.mydomain.com address in your page code, from inbound links, and also in your SEO / SEM efforts. You don't want to end up sharing any of our backlinks between aliases.
Google has developed duplicate content filters to merge the aliases, but this takes time, which we don't have to wait. If you examine, most major sites (with PR 10 rankings -- google.com, w3.org), these sites actually will re-direct your browser to the www subdomain.
- The second possibility, which IMHO is ideal -
2. DNS (BIND) / Apache Configuration (Multiple VirtualHost including re-direct)
Create a CNAME for the primary domain (mydomain.com), and an A record for the secondary www (www.mydomain.com). This connects the subdomain (www) to the actual domain. (Same as 1. above)
Once the DNS configurations have been completed, you add the following VirtualHost's in httpd.conf. The first VirtualHost handles the mydomain.com alias and redirects (saving from having to use mod_rewrite, Regular Expressions in an .htaccess file which causes heavy server load for large sites) while the second VirtualHost for www.mydomain.com actually drives the configuration.
I've included the httpd.conf VirtualHost examples below:
# This config redirects mydomain.com to www.mydomain.com
#80 being the port of your apache server ServerName mydomain.com Redirect permanent / http://www.mydomain.com #... Other Configs (Ex: CustomLog)
# The base VirtualHost config
#80 being the port of your apache server ServerName www.mydomain.com DocumentRoot /home/%uname/www #... Other Configs (Ex: CustomLog)
This configuration will prevent the problem proposed by soution #1 where the URL address in your browser will not change although both will result in a HTTP 200 OK response. It is still wise to use the www.mydomain.com address in your page code, from inbound links, and also in your SEO / SEM efforts. It prevents from you having to concern yourself with sharing backlinks, AND having to depend on duplicate content filters.
I believe this configuration is consistent with major publishers (ie. Google, W3, etc.).
Ultimately, redirection of aliases is a contradiction that exists because of search engines. In a perfect world, it shouldn't be this way.
- The third possibility, as you have described above -
3. Add .htaccess files for the site mydomain.com to redirect
Using Apache mod_rewrite, create a .htaccess file in your DocumentRoot with the following rules, or similar.
RewriteEngine on RewriteCond %{HTTP_HOST} ^mydomain\.com [NC] RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
As I previously mentioned in my above post, your .htaccess file and mod_rewrite will add server overhead. Every request to your domain will result in reading and parsing your .htaccess. From a performance perspective, each time a page under your .htaccess rule is requested, your server must read and parse the rules, evaluate the regular expressions. For large publishers, and / or servers which host multiple sites, this will increase processing and load requirements for the server. It can be easily avoided by using solution #2 and including the redirect in your Apache configuration.
- The fourth possibility, is to add a META REFRESH in your HTML -
4. META refresh
The META refresh tag tells the browser to automatically request another page from the server after a certain number of seconds. This is also called "redirecting" because you're sending the visitor to a page other than they one they requested.
Syntax:
http://www.mydomain.com/">
This META tag will send a visitor to the new URL after 2 seconds. You can set the timing to 0 seconds and have it jump immediately or set it for 30 seconds or longer.
In my opinion, this is a good tool when content and structure has changed, and a previous page is no longer available. You certainly wouldn't want any of the traffic from the engines getting lost, or 404's, so you can continue to host the page with a meta refresh to another page. This will avoid you having to setup extensive server configurations to handle content or structure changes, but is not a good solution for the mydomain.com / www.mydomain.com problem.
--------------------------
This pretty much covers the different ways of handling redirects, and hopefully has provided some educational supplements and / or reference. If there is any other question you have, post it up, i'll do my best. :)
Please find a couple of interesting resources included below.
Best Regards,
Owen
Redirect Check tool:
http://www.internetofficer.com/redirect-check.html
Other Resources:
Articles : ClickZ Experts : The Fine Art of Redirection -- http://www.clickz.com/experts/archives/ebiz/small_biz/article.php/826161
|
|
|
|
|