Faraz Siyal - Web Developer & Designer
Back to All Free Tools
Technical SEO & Server Redirects100% Free to Use

Free .htaccess Redirect Generator (301 & Force HTTPS)

Generate clean, SEO-safe 301 page redirects, Force HTTPS, www to non-www, and domain migration rules for Apache, LiteSpeed, Hostinger, cPanel, and WordPress websites.

Single-Hop Force HTTPS + WWW RulesUnlimited 301 / 302 URL RedirectsCopy or Download .htaccess File

Configure 301 Redirects & HTTPS Rules

Apache & LiteSpeed compatible (Hostinger, cPanel, WordPress)

Single-Hop SEO
Page / URL Redirects (301 / 302)
Optional Security & Clean URL Rules
Apache / LiteSpeed Config

Generated .htaccess Rules

# .htaccess rules generated from farazsiyal.com
# Upload to your website root folder (e.g. public_html/.htaccess)

# Prevent folder directory listing for security
Options -Indexes

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Force HTTPS and Redirect www to non-www (Single 301 Hop)
  RewriteCond %{HTTPS} off [OR]
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^(.*)$ https://yourwebsite.com/$1 [L,R=301]
</IfModule>

# Individual Page & URL Redirects
Redirect 301 /old-services https://yourwebsite.com/services
Redirect 301 /old-blog-post https://yourwebsite.com/blog/new-blog-post
Tip before uploading: Always keep a backup copy of your existing public_html/.htaccess file in Hostinger File Manager or cPanel before pasting new redirect rules (especially on WordPress, place custom redirects above the # BEGIN WordPress block).
.htaccess Redirect FAQs

Frequently Asked Questions

What is the difference between a 301 and 302 redirect for SEO?

A 301 redirect is permanent and passes your Google SEO authority (link equity) from the old URL to the new URL. A 302 redirect is temporary and tells search engines to keep indexing the original URL.

Why should HTTPS and www-to-non-www be combined into a single redirect hop?

If http://www.example.com redirects first to https://www.example.com and then to https://example.com, that creates a slow redirect chain. Our generator combines both into a single-hop 301 rule for faster PageSpeed and cleaner SEO.

Where do I paste these rules on a WordPress site hosted on Hostinger or cPanel?

Open File Manager → public_html → edit .htaccess, and paste your custom 301 redirects right ABOVE the '# BEGIN WordPress' section so WordPress updates never overwrite them.

Does .htaccess work on Hostinger LiteSpeed servers?

Yes! Hostinger uses LiteSpeed Web Server, which is fully compatible with standard Apache mod_rewrite .htaccess rules.

WhatsApp