Htaccess Redirect Generator

Htaccess Redirect Generator

Create htaccess rules to redirect your site links

Select redirect type:

When creating a Hypertext Access file, problems usually prevent the site from working. Most errors occur due to extra spaces or missing commas. For this reason, We decided to make a tool that will help everyone without knowledge of the basics of setting up servers and creating the right htaccess for any CMS.

What is .htaccess?

.htaccess is an additional configuration file for the Apache web server and similar servers. It allows you to set different parameters and permissions for running the web server in separate directories.

This .htaccess file will perform the following tasks.

  • Manages the configuration of the Apache web server;
  • Enabling/disabling functionality and many other features;
  • Handling redirects with and without www
  • Protecting user information and passwords
  • Can block or gain access to an IP address
  • It can redirect users to other websites or links

There is an extensive list of other controls that the file can perform .htaccess. We can't change the file name or file extension. The Apache server will only consider the file name and extensions (.htaccess) in the root directory and ignore all other terms or extensions.

Additional redirection options

Redirect all pages from http:// to https://, including those with http://www on https://

OPTION 1

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

OPTION 2

RewriteEngine On
RewriteCond %{HTTPS} =off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]

OPTION 3

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

OPTION 4

RewriteEngine On
RewriteCond %{ENV:HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Redirect from a domain with WWW to a domain without WWW

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.site.com$ [NC]
RewriteRule ^(.*)$ http://site.com/$1 [R=301,L]

Redirect from a domain without WWW to a domain with WWW

RewriteEngine On
RewriteCond %{HTTP_HOST} ^site.com
RewriteRule (.*) http://www.site.com/$1 [R=301,L]

Setting up a 301 redirect for a site.

The only function where users may have problems. So we decided to describe the detailed instructions. If you follow the sequence described below, you can configure redirects correctly.

  1. Insert a list of old URLs in the first field (each address starts from a new line).
  2. Insert the list of new URLs in the second text field (each URL starts from a new line).
  3. Click the"Create" button.
  4. Copy the resulting code and paste it into your htaccess file.

Avatar

Azahar Ahmed

CEO / Co-Founder

I am Azahar Ahmed, a youthful engineer, vocational trainer, entrepreneur, digital marketer, and motivational speaker hailing from Nagaon, Assam in India.