Htaccess Redirect Generator

Let's Boost Your Website Ranking With Small SEO Tools

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

We at Super Site Tools have developed .htaccess redirect generator tool that helps you create and generate rules for Apache's .htaccess file to implement URL redirects on a web server. The .htaccess file is a configuration file used on Apache web servers to control various aspects of how a website functions, including URL redirection.

Our Htaccess redirect generator can be used for several purposes, including:

  • Redirecting old or outdated URLs to new ones: When you redesign a website or change the structure of your site, you may need to redirect old URLs to their new counterparts to ensure that visitors and search engines can still access the content.
  • Implementing permanent (301) or temporary (302) redirects: Permanent redirects (HTTP status code 301) indicate that a resource has permanently moved to a new location, while temporary redirects (HTTP status code 302) indicate a temporary move. Different types of redirects have different SEO and user experience implications.
  • Creating clean and user-friendly URLs: You can use redirects to make your website's URLs more user-friendly or to create shorter, more memorable URLs for marketing purposes.
  • Fixing broken links: If you have broken links on your website or if external websites are linking to non-existent pages, you can use redirects to send users and search engines to relevant content.

This .htaccess redirect generator typically simplifies the process of creating these redirects by allowing you to specify source URLs and target destinations and generating the necessary .htaccess code for you. This can be especially useful if you're not familiar with writing .htaccess rules manually or if you need to manage a large number of redirects.

Do you want to redirect your pages to a specific URL and want to do it quickly? Use our Free .Htaccess Redirect Tool, it will generate code for .htaccess file with proper redirections rule. Try now. 

About .htaccess Files

On web servers that use Apache Web Server software, you'll find a special file called ".htaccess." This file is short for "Hyper Text access." When you put this file in a specific location on your server, Apache Web Server will follow the instructions inside it.

Here's what you can do with a .htaccess file:

  1. Change Apache Server Settings: You can tweak how Apache works by adjusting its settings.
  2. Turn Features On or Off: You have the power to enable or disable certain website features and functions.
  3. Manage Redirections: You can make web pages automatically send visitors to different pages.
  4. Password Protection: You can safeguard parts of your website with passwords, so only authorized users can access them.
  5. Restrict Access by IP Address: You can block or allow specific people from visiting your website based on their IP addresses.

And there are even more things you can do with .htaccess if you know how to code it.

One important thing to remember: you can't change the name of this file or add extensions to it. If you do, the server won't recognize it. If you've used Content Management Systems like Drupal, Joomla, or WordPress, you might have come across this file and even edited it. But not all web servers allow you to edit it directly. In such cases, you can create your own file with the same name and upload it to specific folders on your server.

How can I redirect www to non-www or non-www to www using .htaccess redirect generator tool?

To redirect either from www to non-www or from non-www to www using an .htaccess redirect generator tool, you need to follow a few steps. The generator tool simplifies the process by providing you with the necessary code. Here are the steps:

  • Go to and search for an .htaccess redirect generator tool online.
  • Input your domain and choose the type of redirect (from www to non-www or from non-www to www).
  • After you've filled in the necessary information, click "Get .htaccess Code". The generator will process your input and create the .htaccess code for you.
  • The generator should display the generated .htaccess code on the screen. Select and copy this code to your clipboard.
  • Access your web server or hosting account where your website files are located, If you already have an .htaccess file, you can open it for editing. If not, you can create a new one.
  • Open the .htaccess file in your text editor or code editor, paste the code you copied from the generator into the .htaccess file.
  • Save the .htaccess file with the name ".htaccess" (including the dot at the beginning) if it doesn't already exist. If you're editing an existing file, simply save your changes.
  • If you're working on a local environment, you may need to upload the .htaccess file to your web server using FTP or a file manager provided by your hosting provider.
  • If you're working directly on your hosting account, the changes will be saved automatically.
  • After saving the .htaccess file, test the redirection by accessing your website with both the www and non-www versions (e.g., and It should automatically redirect to the desired version based on the rules you specified.

Is our Htaccess Redirect Generator Free to Use?

Indeed  our .htaccess redirect generator tool is free to use. Our team at SuperSiteTools have created this online tool as a free resource to help users create .htaccess redirect rules easily without the need for manual coding.

How to create .htaccess file manually?

Creating an .htaccess file manually involves using a text editor to write the necessary directives and save the file with the ".htaccess" filename. Here are the steps to create an .htaccess file manually:

  1. Open a Text Editor: Use a plain text editor to create and edit the .htaccess file. Common text editors include Notepad (on Windows), TextEdit (on macOS), or code editors like Visual Studio Code, Sublime Text, or Atom.
  2. Start a New Document: Open your text editor and start a new document.
  3. Write Your .htaccess Directives: Depending on what you want to achieve with your .htaccess file, write the necessary directives using the appropriate syntax. Here are some common examples:
  • Redirect from non-www to www:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$$1 [L,R=301]
  • Redirect from www to non-www:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$$1 [L,R=301]
  • Custom Error Pages:

ErrorDocument 404 /error404.html
ErrorDocument 500 /error500.html
  • Password Protection:
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /path/to/.htpasswd
Require valid-user
  1. Save the File: After writing the necessary directives, save the file with the name ".htaccess" (including the dot at the beginning) and choose the "All Files" or "Text Files" option when saving to ensure it doesn't get saved with a ".txt" extension. Make sure the file is saved in the root directory of your website.

  2. Upload the .htaccess File: If you're working on a local environment, you may need to upload the .htaccess file to your web server using FTP or a file manager provided by your hosting provider. If you're working directly on your hosting account, the changes will be saved automatically.

  3. Set File Permissions: Ensure that the file permissions for the .htaccess file are set correctly. Typically, it should have permissions of 644 (read and write for the owner, read-only for others).

  4. Test the .htaccess Configuration: Verify that the .htaccess file works as intended. Test any redirects or other directives you've added to ensure they function correctly.

Keep in mind that working with .htaccess files requires careful attention to syntax, as incorrect configurations can impact your website's functionality. Always back up your .htaccess file before making changes, and test your directives thoroughly to ensure they achieve the desired results.