Ga perlu banyak basa basi ,
ane buat trit ini karna disini keknya blm ada trit yg bahas ini
CMIIW
pdhl penting untuk SEO untuk hanya memilih satu antara akses dengan www atau non www 
langsung aja deh...
Metode Dengan .htaccess :
pertama2 buat dulu file .htaccess , caranya ? (untuk windows)
- buka notepad , kosongkan , save di salah satu hdd ente (misal : d:/) dan beri nama htaccess.txt
- start - run - ketik cmd - ok
- change directory ke d: , ketik d: lalu enter
- ketik REN htaccess.txt .htaccess
setelah itu open with notepad file .htaccess nya lalu isi kan :
1.untuk Redirect www to non www :
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
2.untuk Redirect non www ke www :
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
3.untuk redirect example.com/index.php ke example.com/
Code:
Options +FollowSymLinks
RewriteEngine on
# index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
4.untuk redirect example.com/index.html ke example.com/index.php
Code:
RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php
5.untuk redirect oldpage.html ke newpage.html
Code:
Redirect 301 /oldpage.html http://www.example.com/newpage.html
*301 : permanen redirect
Metode dengan PHP :
untuk redirect dari alamat lama ke alamat baru :
Code:
<?php
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: http://www.example.com/");
?>
Metode dengan meta HTML :
taruh diantara tag <head>...</head> :
Code:
<meta http-equiv="refresh" content="10; url=http://example.com/">
*10 : jumlah detik pengunjung sebelum ke redirect
CMIIW ,
TS belum mencoba semua 
hanya pernah mencoba redirect non www ke www
and its works 
source
Share This Thread