.htaccess Redirect Generator — SEO‑Friendly Redirects
.htaccess is the configuration file for Apache web servers. It allows you to control how your website behaves, including URL redirects. Proper redirects are crucial for SEO — when you change a page URL, search engines need to know the new location to preserve your rankings. Our generator creates correct, tested .htaccess redirect rules.
301 vs. 302 Redirects
- 301 (Permanent): Tells search engines that the page has moved permanently. SEO value (page rank, authority) transfers to the new URL. Use when you have permanently changed a URL structure.
- 302 (Temporary): Tells search engines the move is temporary. SEO value does not transfer. Use for maintenance pages, A/B testing, or temporary promotional campaigns.
Common Redirect Scenarios
- www → non‑www (or vice versa): Choose a canonical version and redirect the other. Mixing www and non‑www creates duplicate content issues.
- HTTP → HTTPS: After installing SSL, redirect all HTTP traffic to HTTPS to maintain SEO and ensure security.
- Old URL → New URL: After a site redesign, redirect old page URLs to their new equivalents.
- Trailing slash consistency: Redirect /page to /page/ or vice versa for consistency.
How to Use the Generated Rules
- Create or edit the
.htaccess file in your website's root directory (public_html, htdocs).
- Paste the generated rules at the top or after any existing RewriteEngine directives.
- Test each redirect after adding it to ensure it works correctly.
- Never duplicate RewriteEngine On lines — use it only once.