BH SEO Tools - Optimize your site for free!

All your keywords, competitors and backlink research in one SEO tool!

.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

Get .htaccess Code

4. Copy the code to your .htaccess file

What is redirection:

A redirect is a way forward for a user/crawler from a URL that may be temporarily or permanently inaccessible.

For example, I have a web page URL name ( and we share that URL many with many people via social media or any other way after some time I have been deleted or change the URL or any other reasons that page is not accessible but my page URL already shared with different people, and thorough that URLs.When users, as well as a crawler, will trying come to my site and find a 404 errors page it causes to my site get a bad user experience and also waste crawler resources and it is not a good signal to any website to prevents all this happening I need redirection and I will redirect my deleted page to another page URL ( b) of my website this is called redirection.


Domain redirection:


For example, redirection is a method where we redirect any domain URL to a new domain or website URL. We have a lot of data on it and websites that are already getting good amounts of traffic. For some reason, we have migrated the domain to Now we need to redirect all the old website traffic to the new website. When a user visits our old websites, they will land on a new website webpage. For this, we need to make a redirection from to


Webpages redirection:


If for any reason we have to change our webpage URL or delete webpages, the old URLs are already indexed by search engines or people already have that particular webpage address bookmarked, so when they visit that particular webpage, they will find a page not found error, so we need to redirect the old page URL to the new page URL or for deleted pages, we need to redirect deleted page URLs to any page on our website. We create a redirection in the .htaccess file of our website.


HTTP to HTTPS  redirection:


Before SSL certificates our website was on HTTP after SSL configuration we need to redirect our webpage HTTP to HTTPS and our URLs with HTTP need to redirect to HTTPS for this we configure redirection HTTP to HTTPS :


Redirect from www to non-www :


Redirect from non-www to www :


When we need redirection:


You have changed your website name and migrated the old website to a new domain, or you’re planning to do that, and you worked hard on your old website's SEO and spent a lot of time and resources. You don’t want to lose your old website traffic. The second scenario is if you have changed the website URL or you made it SEO friendly, then your old URL has a broken link. To prevent this from happening, we will redirect the old website to the new website and the old webpage to the new webpage URL. Then you can use our tool Htaccess Redirect is a fantastic tool where you can generate redirection to your website and webpage . Before talking about the tool, we need to understand redirection. Then you will understand which redirection you need.


Types of redirection :


Permeability redirection-301


We use 301 redirection techniques when we need to permanently move any webpage URLs to other webpages URLs and the benefit of permanent redirection when we moved to new URLs with redirection page backlinks and page authority also moved to new URLs.


Temporary redirection 302


We use 302  redirection techniques when we need to temporarily move any webpage URL to a new URL for a particular time for  crawler and users. Sometimes we need to maintain web pages we want during maintenance. Our webpage traffic move to another webpage then we can use 302 redirections.


.htaccess Redirect Generator


For custom websites, you need to access.HTACCESS  file for redirection we need to write redirections code on that file to redirection if you don’t know how to write redirection code you can take help from our free tool .htaccess redirect generate where the tool will automatically generate redirection code and you can paste it on .htaccess file.


How to Use .htaccess Redirect Generator:


To use our tool follow these simple steps:


1- Select redirect Type:


2- Enter a domain name :


3- click get Your code:


4- copy the code and paste it on the .htaccess file


The .htaccess file is present on the root folder of your website for other redirection you can edit code by your need and which type of redirection you want to do.


How to redirect old website to new  by using Cloudflare :


If you’re hosting domains on Cloudflare then you can redirect to new domains on Cloudflare in simple steps:


1-Login Cloudflare 

2-Go domain on Cloudflare 

3- You see  Go Active Subscription and open Page rules

4-create page rule :

5- Enter your URL with (* ) for example (*)

5-Select  Forward URL type 

6-Select status code(301-302)


7 - enter the new website URL with ($1) where you want to redirect 


8- save and deploy page rule:


Now your old website domain successfully redirects to the new domain.

Related Tools