Htaccess Redirect Generator

Htaccess 301 Redirect Generator is an online tool that generates 301 permanent redirects for .htaccess file. Create htaccess redirects for your site to redirect www to non-www and vice versa.

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 301 Redirect Generator

Htaccess redirect generator tool can perform SEO-friendly URL changes and web migrations. Especially when configuring your website's canonical URLs to be indexed and ranked. This helps avoid losing traffic and rankings to your old or non-canonical URLs by redirecting your users and search bots to the new or canonical URL version with permanent redirects. This tool helps user to create 301 redirect code to paste in .htaccess file to redirect non-www to www or vice versa.

What is an htaccess file?

Htaccess is an Apache web server configuration file that you can use to control the behavior of your website. Htaccess configuration files can be deployed on web servers running Apache web server software. When this file is deployed the Apache web server will detect and execute the commands in this file. This file can be used:

  • Setup different types of redirects on your website.
  • Change the Apache web server configuration.
  • Block bad robots and IP addresses.
  • Enable/disable functionality and features.
  • Add security and caching instructions.

There are many additional functions that can be coded in the .htaccess file for your website. Cannot rename the file or add any extension to it. If you rename or save it with an extension and upload it; It will not be recognized. If you use a content management system like Drupal, Joomla, or WordPress, you may encounter this file. You can also edit it. Some web servers do not allow you to edit the .htaccess file. But you can create your own files and upload them to specific directories.

How to create .htaccess file?

You can easily create .htaccess files using good text editors like Microsoft WordPad, TextPad and UltraEdit. An .htaccess file can contain a single or multiple lines depending on the functions you want to include.

You must use an FTP (File Transfer Protocol) program to upload files. Also you need to upload the file in "ASCII" mode. Some FTP programs use "binary" as the default for uploading files. If so, you must change it to "ASCII". Upload the file to the directory where you want it to be.

After uploading, if you try to search for the htaccess file in your web directory, you may not find it because the web server software may hide it. So there is no need to panic because, in some file systems, files starting with dot(.) are considered as hidden files.

How to use htaccess redirect generator tool?

This htaccess redirect generator tool is very easy to use. Follow the steps below:

  • Choose Redirect Type. It can be www to non-www or non-www to www.
  • Enter your domain name. Make sure you are not using the www or https protocol.
  • Click the Get .htaccess code button. The tool will generate the redirect code for your selection within seconds.
  • Copy the code and paste it into your .htaccess file using FTP or a file manager.

Check in the browser that both www and non-www versions of your site are pointing to the correct site. Be sure to submit the XML sitemap for the correct version of your site in Google Search Console.

Our goal is to make search engine optimization (SEO) easier for everyone. We provide simple, professional quality SEO analysis and critical SEO monitoring for websites. By making our tools intuitive and easy to understand, we've helped thousands of small business owners, webmasters and SEO professionals improve their online presence.