.htaccess Generator
Pick what your Apache server should do and copy the finished rules.
HTTPS and www
Move to a new domain
Page redirects
Custom error pages
Access and security
Speed
Back up your current .htaccess first. A wrong rule can take a site offline. These rules are for Apache 2.4.
Choose what your Apache server should do and get the rules in the right format, without memorizing the syntax.
Features
Use Cases: When This Tool Helps
-
Force HTTPS after installing SSL
Redirect every http:// visit to https:// so browsers stop showing "Not secure".
-
Move to a new domain without losing SEO
Create 301 redirects that send visitors and rankings to the new site.
-
Pick www or non-www
Redirect one version to the other to avoid duplicate content.
-
Fix broken links after a redesign
Redirect old page URLs to their new locations.
-
Block spam bots and bad IPs
Deny access to abusive IP addresses hammering your server.
-
Speed up shared-hosting sites
Enable caching and compression rules to improve load times.
How to Use
- Pick the options you need.
- Review the generated rules.
- Back up your old file, then upload the new .htaccess.
FAQ
Which servers does this work on?▾
Apache 2.4 with .htaccess files allowed. Nginx and Caddy do not read them.
What is the difference between 301 and 302?▾
A 301 tells search engines the move is permanent. A 302 is temporary.