If you dont like to the www in your domain just add this to your htaccess file
RewriteEngine on
#
## no-www
#
rewritecond %{HTTP_HOST} ^www\.localhost\.com$ [NC]
rewriterule ^(.*)$ http://localhost.com/$1 [R=301,L]
If you dont like to the www in your domain just add this to your htaccess file
RewriteEngine on
#
## no-www
#
rewritecond %{HTTP_HOST} ^www\.localhost\.com$ [NC]
rewriterule ^(.*)$ http://localhost.com/$1 [R=301,L]
If you want the www in your domain then write this into your htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
#
## require-www
#
RewriteCond %{HTTP_HOST} !^www\.localhost\.com$ [NC]
RewriteRule ^(.*)$ http://www.localhost.com/$1 [R=301,L]
htaccess files can give you extra control to your server like blocking some ip, redirect to other page or site, generate custom error messages and many more. (For more info see the guide to .htaccess).
Writing your first htaccess file
Create a file that name: .htaccess
Don’t forget to put a dot before the htaccess then write this code below
DirectoryIndex default.php
Be sure that you have allowed to write a htaccess file contact your hosting administrator about it.
The DirectoryIndex is where your default page set. For example if you want your default page is your home.php scripts just change it into
DirectoryIndex home.php
We will posting more about tips and tricks in htaccess nextime Continue reading ‘How to write first htaccess’