Hello, What should i do for redirecting my website in proper URL like http://www.mywebsite.com/ when anyone type website URL like mywebsite.com or www.mywebsite.com or http://mywebsite.com. Is there any need to contact website hosting server for that? Your quick reply will be appreciated. Thanks Sushila
No need to contact your server. This is done with a simple .htaccess file. RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.htm\ HTTP/ RewriteRule ^index\.htm$ http://www.yoursite.com/ [R=301,L] RewriteBase / RewriteCond %{HTTP_HOST} ^yoursite.com$ RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L] This one redirects the www.yoursite.com/index.htm/l to www.yoursite.com too. Replace htm with html or php or any file extension you use.
Thanks monfis for your quick reply. could you please answer me Where i have to put this code in the website?
This code is not placed in the website. Place it in a simple text file with notepad or any simple text editor. save it and and name it .htaccess! (with the . dot in front) Then upload the file to the root directory (where your /index page is found). once uploaded you will not be able to see it but it's there, telling the server what to do. In case anything "goes wrong" just upload an empty file with the same name (.htaccess) this will overide any existing (wrong) file and you can start again with corrected code.