Htaccess Redirect Generator

1. Select redirect type

2. Enter your domain name

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

3. Get your code

4. Copy the code to your .htaccess file

About Htaccess Redirect Generator

A .htaccess file is a directory-level configuration file supported by several web servers, used for configuration of website-access issues, such as URL redirection, etc. For example, you have an index page on your website and you request an unknown page then your apache server redirects you to your index page because by default in apache’s configuration file it is redirected to the index file. However, you can generate your own .htaccess file to redirect to any page on your website in case of any error, file not found, etc. Similarly, Using Redirect in a .htaccess file enables you to redirect users from an old page to a new page without having to keep the old page. For example, if you use index.html as your index file and then later rename index.html to home.html, you could set up a redirect to send users from index.html to home.html. There is another option in this tool that is www to non-www and vice versa. By default, your website can be accessed with both and Since Google penalizes this due to duplicated content reasons, you should restrict the access to either or Now what this tool does for you is very important, let us understand this with two examples.

Example no 1:

RewriteEngine On

            RewriteCond %{HTTP_HOST} !^$ [NC]

            RewriteRule ^(.*)$$1 [L,R=301]

Example no 2:

RewriteEngine on

            RewriteCond %{HTTP_HOST} ^www\.anything\.com$

            RewriteRule ^/?$ "http\:\/\/ anything\.com\/" [R=301,L]

Example 1 is redirecting code for non-www to www, whereas example 2 is redirecting code for www to non-www, this tool generates these codes for you and you can easily copy generated code and use it.

 How .htaccess Redirect Generator Tool Works

  1. Select redirect type: as mentioned above, there are two ways, www to non-www and vice versa. you only need to check one option among the two.

  2. There is an input field with the caption ‘Enter your domain’, enter your domain as asked, that will go to the ‘’ part of the code

  3. Click on ‘get .htaccess code’ button to get your redirecting code

  4. Finally, copy your code and paste it in your .htaccess file. 

   What is the benefit of using .htaccess Redirect Generator Tool?

There is no need to download and install any software or tool on your device to use this tool. In addition, there are no device constraints; you can use this tool from any device. User-friendly Graphical User Interface makes you feel better while using this tool. This tool is free of cost and available with all features with no irritating ads. Although this is a web-based online tool, still you need not sign up or log in to use this tool.