What is this title about ? i can't find the right sentences for this article..hhehe....
This article is about redirecting Host use .htaccess in your root directory, so if people visited your website without typing "WWW" in address, automatically the address will change with "WWW". This is cool isn't it ? not really i guess, hhaha.
just check this out for how to.
This is for example, if you typing "Facebook.com" in your address bar and go to there, in automatically the address will change to be "www.Facebook.com" as well if you access your account, your profile url, photo url will change too. Wow, how can you do that ? it's a magic ? hhaha...i'm funny right...? ^_^
now go to the tutorial. First go to your root directory in your hosting. Make .htaccess file and add this following code :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
Save in your root directory (e.g public_html, htdocs etc). This is work to apache server website and if your using PHP just add this following code:
Good luck ^_^, i'm sure you can do it.<?php
if (!preg_match('/^www/is', $_SERVER['SERVER_NAME'])) {
Header('HTTP/1.1 301 Moved Permanently');
Header('Location: http://www.'.$_SERVER['SERVER_NAME']);
exit;
}
?>
Quote this day:
If the others can do, why not us
0 komentar:
Posting Komentar
Lebih baik diam daripada tidak bisa bicara baik, (Silent is gold)