Technical SEO

.htaccess Redirect Generator Online

Generate Apache rules to redirect URLs, change domains and set a canonical HTTPS or host version.

HostingerFast hosting for your websiteHosting, domain and SSL in one place.View offer ↗HostingerLaunch your website todayReliable hosting for new projects and growing websites.View offer ↗
Before applying changesBack up your .htaccess first. An incorrect rule can cause 500 errors or redirect loops.

Generated .htaccess code

Redirect or mod_rewrite is selected according to the case.

Redirect guide

What is .htaccess?

.htaccess is a configuration file commonly used by Apache to apply directory rules, including redirects.

301 and 302 redirects

A 301 indicates a permanent change and a 302 a temporary change. Choose the status that matches the real situation.

Redirect versus RewriteRule

Redirect suits simple cases. mod_rewrite supports conditions, host changes, HTTPS, patterns and query-string control.

Migrations and canonical versions

During a domain change, keep paths when needed and avoid redirect chains by choosing one canonical version.

Frequently asked questions

Questions about .htaccess redirects

How do I make a 301 redirect in .htaccess?

Choose Single URL, enter source and destination, select 301 and generate the rule.

What is the difference between 301 and 302?

301 is permanent and 302 temporary. Search engines may treat each change differently.

How do I redirect HTTP to HTTPS?

Select HTTP to HTTPS and review the rule before applying it in Apache.

How do I remove www?

Select www to non-www and enter the main domain.

How do I add www?

Select non-www to www and enter the domain that should be canonical.

How do I redirect an old domain to a new one?

Use Domain change and enable Keep subpaths when paths should be preserved.

Can a wrong rule cause a 500 error?

Yes. Back up the file and test changes before publishing them.

What is the difference between Redirect and RewriteRule?

Redirect is simple; RewriteRule supports more advanced conditions and patterns.

Does the tool modify my .htaccess?

No. It only generates text for you to review and apply manually.