Sabtu, 19 Juni 2010

Google Friendly Domain Redirect

Buzz It

Google friendly domain redirect

You must use Google friendly domain redirect in these cases:

  1. You changed a domain name for your web page and want the old one to redirect visitors to a new one.

  2. You have many domains for your website (one primary and many alternative).

  3. You want to strip the ‘www’ part from the domain name.


How to redirect?
For case #1 and #2 you must point (alias) all the domains to the same website. Ask your server


administrator or hosting providers how to do that. Some times hosting providers call this – domain parking.

Select configuration for desired case below. Replace domain names with your real ones and paste the code to file named ‘.htaccess’. Upload the file it into the root folder of your web page.

Configuration for case #1

RewriteEngine On

RewriteBase /

 

# redirects old domain to a new one

RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$

RewriteRule ^.*$ http://www.newdomain.com%{REQUEST_URI} [R=301,L]

Configuration for case #2

RewriteEngine On

RewriteBase /

 

# redirects any alternative domain which name isn't "www.primarydomain.com"

RewriteCond %{HTTP_HOST} !^www\.primarydomain\.com$

RewriteRule ^.*$ http://www.primarydomain.com%{REQUEST_URI} [R=301,L]

Configuration for case #3

RewriteEngine On

RewriteBase /

 

# strips the "www"

RewriteCond %{HTTP_HOST} ^www\.domain\.com$

RewriteRule ^.*$ http://domain.com%{REQUEST_URI} [R=301,L]

Sumber : http://www.webtoolkit.info/google-friendly-domain-redirect-using-apache-rewrite.html



Tidak ada komentar:

Posting Komentar