.htaccess Redirect Generator — SEO‑Friendly Redirects
.htaccess is the configuration file for Apache web servers. Proper redirects are crucial for SEO — when you change a page URL, search engines need to know the new location to preserve your rankings.
301 vs. 302 Redirects
- 301 (Permanent): Tells search engines the page has moved permanently. SEO value transfers to the new URL.
- 302 (Temporary): Tells search engines the move is temporary. SEO value does not transfer.
Common Redirect Scenarios
- www → non‑www: Prevents duplicate content issues.
- HTTP → HTTPS: After installing SSL, redirect all HTTP traffic to HTTPS.
- Old URL → New URL: After a site redesign, redirect old URLs to new ones.
How to Use the Generated Rules
- Edit the
.htaccess file in your website root (public_html or htdocs).
- Paste the generated rules after any existing
RewriteEngine On line.
- Never duplicate the
RewriteEngine On directive.
- Test each redirect after applying.