.htaccess Redirect Example

A basic Apache redirect snippet for one moved URL. Back up .htaccess before editing production rules.

.htaccess snippet
RewriteEngine On
Redirect 301 /old-page /new-page

How to use this example

  1. Put redirect rules before broad application rewrites when needed.
  2. Test the old URL with curl -I.
  3. Keep a backup of the previous .htaccess file.

Notes

  • Incorrect rules can cause redirect loops or 500 errors.
  • Use 302 while testing uncertain behavior.

Related tools and fixes

Last updated: May 18, 2026