How to use it
- Choose Apache or Nginx and the status code.
- List each old path and its new path or full URL.
- Copy the rules into your server configuration.
How it works
For Apache each line becomes a RedirectMatch rule with an exact, escaped pattern (^/old\.html$), so only that exact path is redirected. For Nginx each line becomes location = /old { return 301 …; }. Use 301 or 308 for permanent moves and 302 or 307 for temporary ones.
Examples
- /old-page.html /new-page/ becomes RedirectMatch 301 "^/old-page\.html$" "/new-page/".
Limitations
- Only exact paths are handled: query strings, wildcards, regex rewrites and whole-domain moves are not generated. Paths and targets with spaces, quotes or special characters are rejected to keep the rules safe. Test the rules on a staging copy first, since a wrong rule can break a site or cause loops. Other servers (IIS, Caddy, CDNs) have their own syntax.
Last verified . See our Accuracy & Editorial Policy. Found a problem? Email [email protected].