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

About Htaccess 301 Redirect Code Generator

The htaccess redirects tool can help you perform SEO-friendly URL changes and web migrations, especially when configuring your website's canonical URLs that are meant to be indexed and ranked. This enables us to avoid losing your old or non-canonical URL traffic and rankings by redirecting your users and search bots to the new or canonical URL versions through permanent redirects.

The tool creates 301 redirect codes for non-www to www and vice versa, which you can easily paste into yours. htaccess file. 

What is a .htaccess file?

If you're currently working (or have already worked) on some CMS, you may be familiar with the. htaccess configuration file. "htaccess" stands for Hyper-Text Access. It is a configuration file that controls how the server responds to web requests.

Upload the .htaccess file on the web servers running the Apache Web Server software. If a file has been uploaded to a server, it knows that a specific instruction or command is meant for that file, and it executes those commands.

How do I create a .htaccess file?

Creating the. htaccess file is easy and straightforward. All you need to do is open Notepad++ or Microsoft VSCode, type a. This file consists of different lines, depending upon the instructions that the web developer wants to convey.

You require a File Transfer Protocol (FTP) program to upload the file, and the file must be uploaded in the correct directory and must be uploaded as a plain text file, in The BINARY option is used by some FTP clients to allow you to upload files directly from a local file system without storing them in a remote location first. Okay, then you must change it to ASCII. The first time you upload the file to your web server, it will look for the file and try to put it into your root web directory. You don't need to panic because the files that begin with a dot (.) are often treated as hidden files.

How do I redirect my site using a .Htaccess file?

Google considers each URL version as an entirely different entity. They differentiate between the URL with www and non-www, even if they both land on the same domain.

Thus, for Google to know about the primary page, canonical tags are used to avoid keyword cannibalization, and 301 redirects are made so your link juice, ranking, and traffic would not get affected by the redirects. .htaccess is a powerful website file that controls your high-level website configuration.

That file allows you to make changes to your website's configuration without editing the files used to configure your web server.

A.htaccess file will allow you to make SEO-friendly URL changes and web migration so that your website traffic and ranking would not get affected, and you can redirect the users and the bots from the old URLs to new URLs with 301 redirects.

The SEOs sometimes ask, are too many 301 redirects harmful to SEO?

To be precise, there are no boundaries when it comes to using 301 redirects on your website. In order to implement over 100,000 redirects, you can use the 301 redirect function of the Web multiple redirects can slow down the speed at which your website loads.

To get the .htaccess 301 redirect code for redirecting your site from non-www to www or vice versa, perform the following measures.

  • Create a text file using any text editor, like Notepad++.
  • Save the file with the name of .htaccess (without any further file extension).
  • Open the Htaccess Redirects & Rewrite Generator tool.
  • Enter the website name on the text field.
  • Select redirect type. Two options are provided.
  • Redirect from www to non-www
  • Redirect from non-www to www
  • After selecting the option, click on the "Get your Htaccess Code" button.
  • The tool will ask about your process and give you the code.
  • Please copy the resulted code, and paste it to the desired location.


The order of the URL links in the. htaccess file determines which URL should be processed first. Use the length formula to determine the number of words in each URL. When your URL is longer than the length limit (default is around 300 characters), the page isn’t displayed.

What if I have lots of 301 redirects!

The bigger the. htaccess file gets the more difficult it will become to work with it and work within its restrictions. The longer your site takes to load, the slower it will be for visitors.

A good solution is to move to a database-driven redirect system. Databases offer faster lookup of large datasets than the. htaccess file solution. Most CMSes have plugins that will let you manage the user reviews, but if you want to add them manually, you’ll need to

Redirection is very useful for WordPress sites because it makes managing redirects much easier.

The best solution for these situations is Apache RewriteMap. This is quite technical, but it allows you to create lookup tables and therefore will scale better than the basic RewriteRule.

It is possible to add Google maps for mobile apps at the server level. This means it is not an option for those who use shared hosting or are only using their own servers.

How to handle query strings on redirect (htaccess redirect url containing a string)

Replace query-string urls in JavaScript code that uses URL objects and you’ll never have to worry about rewriting URLs again. To keep the user's privacy intact, the default action with query strings should be to skip the request.

You can also add query strings to a new URL, as well as combine old and new query strings. You will need to select the appropriate htaccess rewrite rule generator option.

How to insert the code into the .htaccess file

First of all, do not insert the code inside a common code block generated by WordPress, Joomla, or other CMS, because this way the code can be overwritten after a CMS update. Place the code at the begging of the file or where other already working redirects are located.


[email protected]


45635 Pueblo Rd, Indian Wells, California 92210, USA

You may like
our most popular tools & apps