Htaccess Redirect Generator

Htaccess Redirect Generator

Select redirect type:

If you're looking for an easy way to redirect your visitors, look no further than our Htaccess Redirect Generator. Just enter the old and new URLs, and we'll take care of the rest!



A .htaccess file is a configuration file used on web servers running the Apache Web Server software. When a web server receives a request for a page from a visitor, it looks for a .htaccess file in the visitor's website directory. If it finds one, it follows the instructions in that file. If it doesn't find one, it will serve the page usually.

The .htaccess file is helpful for many things, such as password-protecting directories, creating custom error pages, and redirecting visitors to another location.

This article will show you how to use the .htaccess file to create 301 redirects. A 301 redirect is a permanent redirect from one URL to another. It tells visitors and search engines that the page they're looking for has permanently moved to a new location.

If you're not familiar with editing files on your web server, we recommend that you contact your web hosting provider for help with this.


What is .htaccess?

.htaccess is a configuration file used by Apache web servers to control server functionality and features. The file is placed in the root directory of a website and contains directives that tell the server how to handle specific tasks.

One everyday use of .htaccess files redirects visitors from one page to another. This can be useful if you need to change the URL of a page for any reason. For example, you might want to redirect visitors from an old page that no longer exists to your home page, or you might want to turn them to a new page on your site.

Redirecting visitors with .htaccess is pretty simple, and a few different directives can be used to accomplish this task. The most commonly used directive for redirects is the Redirect directive, which can be used in two different ways.

The first way to use the Redirect directive is to specify the URL of the page you want to redirect visitors to:

Redirect /oldpage.html

This directive will redirect visitors who try to access oldpage.html to newpage.html on your site. You can also use relative URLs in this directive, so if your pages are in the same directory, you could use the following:

Redirect /oldpage http://www./newpage


How can .htaccess be used for redirects?

The .htaccess file is a simple text file found in the root directory of your website. This file can direct users to different sections or pages of your website or redirect them to an entirely different site.

One everyday use for .htaccess files is redirecting users from an old page to a new one. This is often done when a page has been moved or renamed, and you want to ensure that users can still find it. Redirecting users in this way also allows you to keep any inbound links pointing to the old page from becoming broken.

To set up a redirect using .htaccess, you will need to edit the file and add a line of code that looks like this:

Redirect 301 /oldpage.html

In this example, "/oldpage.html" is the location of the page you want to redirect, and "" is the redirect's destination. You can also use relative URLs for both the source and destination of the redirect, like this:

Redirect 301 /oldpage.html /newpage.html


What are the benefits of using .htaccess for redirects?

.htaccess files allow you to manipulate how Apache serves files to visitors. One of the most common uses for .htaccess files is creating redirects. By using redirects, you can point an old URL to a new one without manually updating links or pages on your site. This can be useful if you’ve changed the structure of your website or if you want to point visitors to a different website altogether.

Redirects can be used for several different purposes:
-To redirect Visitors from one page on your site to another page on your site
-To redirect Visitors from one site to another
-To prevent Visitors from accessing specific pages on your site
-To create “vanity” URLs, which make long and complicated URLs shorter and easier to remember


How to set up .htaccess redirects?

.htaccess is a configuration file used on Apache web servers. It allows you to modify server configuration without changing server software or restarting it.

One everyday use for .htaccess files is to set up redirects. Redirects are used to map old URLs to new URLs or different domains to your primary field.

Here are some examples of .htaccess redirects:

Redirect old to
Redirect 301 /

Redirect to
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$$1 [L,R=301]

The above examples show how to redirect an entire site, but you can also use .htaccess redirects to map specific pages or files on your site. For example, if you want to turn to http://www.example/newpage/, you would add the following line to your .htaccess file: Redirect 301 /oldpage/ http://www.example/newpage/


Tips for using .htaccess redirects

.htaccess redirects are a server-side way to redirect visitors from one page to another. While there are other ways to do redirects, .htaccess is the easiest and most flexible method.

There are two main types of .htaccess redirects:
-Redirecting www to non-www
-Redirecting HTTP to HTTPS

Redirecting www to non-www:
The www version of your website is not the same as the non-www version. For example, and are two different websites. Search engines treat them as other websites, so it’s essential to choose one and stick with it.

If you want to redirect www to non-www, you can add the following code to your .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule (.*)$1 [R=301,L]
Replace “” with your domain name. This code will redirect visitors from to

Redirecting HTTP to HTTPS: If you have an SSL certificate installed on your website, you can redirect visitors from HTTP to HTTPS by adding the following code to your .htaccess file:

RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$$1 [R=301,L]

Replace "" with your domain name


Troubleshooting .htaccess redirects

If you are having trouble with your .htaccess redirect, check the following:

-Make sure you have enabled mod_rewrite in Apache. This is typically done by uncommenting the following line in your httpd.conf file:
LoadModule rewrite_module modules/

-If you are using virtual hosts, ensure that the redirect is enabled in the correct virtual host configuration.

-Make sure you have restarted Apache after any changes to the httpd.conf file.

-Check the syntax of your .htaccess file. If you use a text editor other than Vim, ensure that your editor does not add any extra characters to the file (such as extra whitespace).


Conclusion (Htaccess Redirect Generator)

This tool can be used to generate a .htaccess file that will redirect visitors to a new location. The settings can be customized to match the specific needs of your website.

Once you have generated the .htaccess file, you must upload it to your website's root directory. Please contact your web hosting provider for assistance if you are unsure how to do this.