.htaccess redirect generator
Enter your urls to make redirect:
Basic redirects
Redirect from HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Redirect from www to non-www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
Redirect from non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Redirect from all domains to main domain
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]
.htaccess Redirect Generator - Create Proper Redirects in Seconds
.htaccess redirect generation tool from 2index.ninja — is a simple and free way to create correct redirect rules for websites on an Apache server. It allows you to easily set up 301, 302, and other types of redirects without errors or unnecessary code.
Redirects are an important part of technical SEO optimization. Incorrectly configured redirects can lead to lost traffic, dropped rankings, or even complete page inaccessibility. This generator will help you avoid such problems and correctly redirect old URLs to new ones.
🔹 What the htaccess redirect generator can do:
-
✅ Generate 301 (permanent) and 302 (temporary) redirect rules
-
✅ Support for redirecting both individual URLs and entire directories
-
✅ Ability to set up redirects from www to non-www (and vice versa)
-
✅ Redirects from HTTP to HTTPS (or vice versa)
-
✅ Support for regular expressions and URL parameters
-
✅ Clean and valid
.htaccesscode, ready to be inserted
🔹 When a redirect is needed:
-
When changing the URL structure or domain
-
After deleting or moving pages
-
When merging multiple sites into one
-
To eliminate duplicates (e.g.
site.comandwww.site.com) -
To force a switch to the secure HTTPS protocol
-
When implementing CHPU and link optimization
🔹 Advantages of the tool from 2index.ninja:
-
Fast and easy. No need to understand Apache syntax—just enter the required parameters.
-
Flexibility. The generator is suitable for both targeted redirects and bulk redirects.
-
Security. Work happens directly in the browser, without transferring any data.
-
SEO-Friendliness. Generating correct redirects that won't harm indexing.
-
Free and without registration
🔹 How to use:
-
Go to the page: https://2index.ninja/ru/tools/htaccess-redirect
-
Enter the old and new URLs, select the redirect type
-
Configure additional settings if necessary.
-
Click "Generate"
-
Copy the generated code and paste it into the
.htaccessfile on your server.
📌 Why choose 2index.ninja?
2index.ninja — is a platform for speeding up indexing and professional SEO tools. The htaccess redirect generation tool saves time, reduces the risk of errors, and helps maintain website rankings during changes. It will be a useful assistant for SEO specialists, webmasters, administrators, and developers.
I will help you solve this problem