Sebuah buku kecil yang sangat bernilai!

Banyak hal yang dilihat,didengar,dibaca dan dipelajari, dan banyak juga yang akhirnya lupa.

Redirect domain dan subdomain shared hosting di file .htaaccess

Pada account shared hosting yg mempunyai lebih dari 1(satu) domain atau subdomain, masing-masing domain dapat diarahkan ke folder tertentu dengan menambahkan beberapa baris code ke dalam file .htaaccess.

Untuk server hosting linux code yg ditambahkan adalah :
#Turns the rewrite engine on.RewriteEngine on

#Fix missing trailing slash character on folders.
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]
#www.domain.com and domain.com will map to the folder {root}/folder1/
RewriteCond %{HTTP:Host} ^(?:www\.)?domain\.com$
RewriteCond %{REQUEST_URI} !^/folder1/
RewriteRule ^(.*) folder1/$1 [NC,L,NS]

#www.otherdomain.com and otherdomain.com will map to the folder {root}/folder2/
RewriteCond %{HTTP:Host} ^(?:www\.)?otherdomain\.com$
RewriteCond %{REQUEST_URI} !^/folder2/
RewriteRule ^(.*) folder2/$1 [NC,L,NS]
#subdomain.domain.com will map to the folder {root}/folder3/
RewriteCond %{HTTP:Host} ^(?:subdomain\.domain\.com)?$
RewriteCond %{REQUEST_URI} !^/folder3/
RewriteRule ^(.*) folder3/$1 [NC,L,NS]


dan untuk server hosting Windows code nya adalah :

#Turns the rewrite engine on.RewriteEngine on

#Fix missing trailing slash character on folders.
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]
#www.domain.com and domain.com will map to the folder {root}/folder1/
RewriteCond %{HTTP:Host} ^(?:www\.)?domain\.com$
RewriteRule (.*) /folder1/$1 [NC,L,NS]

#www.otherdomain.com and otherdomain.com will map to the folder {root}/folder2/
RewriteCond %{HTTP:Host} ^(?:www\.)?otherdomain\.com$
RewriteRule (.*) /folder2/$1 [NC,L,NS]
#subdomain.domain.com will map to the folder {root}/folder3/
RewriteCond %{HTTP:Host} ^(?:subdomain\.domain\.com)?$
RewriteRule (.*) /folder3/$1 [NC,L,NS]


sumber :
http://www.brinkster.com/kb/Article-125-How-do-I-redirect-a-domain-or-subdomain%3f
Share on Google Plus

About Does

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment