Home Image Editor

Htaccess Redirect Generator

1. Select redirect type

2. Enter your domain name

Do not include www. Domain name only - e.g. yourdomain.com

3. Get your code

4. Copy the code to your .htaccess file

About Htaccess Redirect Generator

About .Htaccess

The .htaccess configuration file can be easily placed on web servers running the Apache Web Server software. .htaccess is short form for Hyper Text access. When this file is placed, the Apache Web Server will detect and run the commands in this file. This file can be used to:

  • Change configuration of Apache Web Server
  • Enable/disable functionality and features
  • Handle redirects
  • Protect passwords
  • Disallow access to visitors by IP address
  • And redirect visitors

There are other additional functions that the .htaccess file can perform. The name of the file cannot be changed or an extension cannot be added to it. In case you try to do that, the file will not be recognized. If you have used a Content Management System before, like Drupal, Joomla or WordPress you might have seen this file. You might also have edited it. Few web servers do not let you edit it. However, you can create your own file and upload it to specific directories.

How To Create .Htaccess File

You can use a quality text editor like TextPad, UltraEdit and Microsoft WordPad to create the .htaccess file. But, you cannot use Microsoft NotePad. You can also enable password protection, or redirect to a custom error page, if a user fails to login. You can also redirect to a custom page if an error is encountered by a user. An .htaccess file can contain a single line or multiple lines. That depends upon the functions you want to include in it. You will need an FTP (File Transfer Protocol) program to upload the file. You must also upload the file in “ASCII” mode. Few FTP programs use “BINARY” as the default to upload files. In that case you must change it to “ASCII”. Upload the file to the directory you want it to stay in. When you look at the files in your website’s directory you might not see it, because your web server’s software is probably hiding it.

Error Handling

.htaccess file is very useful in handling errors. Visitors get irritated when they encounter error messages like a 401, 404, 500 message on a website. This is where the .htaccess file can be used to display a friendly message to visitors when they face any problem in accessing your website.


Redirects enable a webmaster to redirect his or her website’s visitors from one page to another within the same website. A visitor can also be redirected to a different website. This is a very useful tool when webmasters don’t want the visitors to be able to view some particular pages on the website.

Password Protection

This is probably the most important function that a webmaster might want to include. They don’t want unauthorized people to visit and access their site. For example, you must have an authentic user id and password to access your email account. When there is password protection, a user feels more secure in sharing information on the website. Even all the popular social media sites are also password protected. To protect your website with a password, you will need to place some instructions in your .htaccess file.

Deny Visitors

This function can be included in your website using the .htaccess file. Some sites do not want to allow visitors from some particular IP addresses to access their site. This function is extremely critical in blocking out undesired visitors. The webmaster can choose which IP addresses to allow visiting the site and which IP addresses to block. Webmasters mostly allow visitors from a specific range of IP addresses. Thus it automatically blocks visitors from any other IP address. Organizations, government agencies use this feature to block unauthorized visitors.

If you come across a large number of visits from an unknown site, you can block that site in case you think they may be pinching your CSS files. You can also disallow access by referrers.

.Htaccess Redirect Generator

Webmasters require the .htaccess file on the webserver. It requires them to know html code. The commands for the .htaccess file to execute can be created by using a text editor. But that 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 for you on smallseotools.com. If you want the tool to generate the code to include in your website’s .htaccess file, you simply have to search for smallseotools.com from your search browser. Once you’re on the site, scroll down to the .htaccess redirect generator tool icon and finallyclick on it. It will display two options;

  • Redirect from www to non-www
  • Redirect from non-www to www

The default selection will be the first option.Next, you need to enter your domain name and then just press ‘get your code’ button. You will find a captcha that will be required for verification. Once done, the code generated will be displayed in the Results box. You  can now copy the code from here and paste it into your .htaccess file.

After the .htaccess file is successfully updated, it will perform the redirect function. Now the website visitors will be redirected to another site.


The .htaccess file is an extremely useful tool for webmasters to have a control over their websites. They can give user friendly messages in case an error occurs, apply password restrictions, redirect visitors, deny access from selected IP addresses, etc. The webmaster has to be thoroughly familiar with all the options and must know how to create an htaccess file and how to use htaccess, to provide all these facilities on Apache based web servers. A webmaster can get help from a developer. He or she can even become familiar with coding in HTML. Remember any modifications made in this file will have a direct impact on the way the website works and responds to users’ request. Therefore you must know what you are doing and exactly how to do it while making changes in the .htaccess file of a website. Do not try to make any changes if you are unfamiliar with the commands that you can encode in .htaccess.