On web servers running the Apache Web Server software the .htaccess configuration file can be placed. .htaccess is an abbreviation for Hyper Text access. When this file is placed the Apache Web Server will detect and execute the commands in this file. This file can be used to:
There are other additional functions that the .htaccess file can be coded to perform. The name of the file cannot be changed or an extension added to it. In case you change the name or save it with an extension and upload it; it will not be recognized. If you have used a Content Management System like Drupal, Joomla or WordPress you might have encountered this file. You might also have edited it. Some web servers do not allow you to edit it. But you can create your own file and upload it to specific directories.
You can create the .htaccess file using a good text editor like TextPad, UltraEdit and Microsoft WordPad. You cannot use Microsoft NotePad. You can enable password protection, redirect to a custom error page if a user fails to login, or redirect to a custom page if an error is encountered by a user. An .htaccess file can contain a single or multiple lines depending upon the functions you want to include in it. You will need to use an FTP (File Transfer Protocol) program to upload the file. Also you must to upload the file in “ASCII” mode. Some FTP programs use “BINARY” as the default to upload files. If that’s the case you must change it to “ASCII”. Upload the file to the directory you want it to reside in. when you look at the files in your website’s directory you might not see it as your web server’s software is probably hiding it.
Placing all the commands that webmasters might want in the .htaccess file on the web server requires them to know html code. Yes, the commands for the .htaccess file to execute can be created using a text editor but cannot be placed as a tool.
To perform a redirect from non-www to www or from www to non-www there’s a .htaccess tool available on smallseotools.com. if you want the tool to generate the code to include in your website’s .htaccess file, navigate to smallseotools.com from your search browser. On the site scroll down to the .htaccess redirect generator tool icon and click on it. It has two options;
The default selection is the first option. Enter your domain name and press ‘get your code’ button. There’s a captcha that will require verification. Once you have done that the code generated will be displayed in the Results box. Now you can copy the code from here and paste it in your .htaccess file.
After successfully updating the .htaccess file it will perform the redirect function. Now the website visitors will be redirected to another site seamlessly,