Create redirect rules for Apache (.htaccess) or Nginx: page-to-page 301 redirects, forcing HTTPS, and choosing www or non-www.
Loading the tool…
Redirect types
| Code | Meaning | Use for |
|---|---|---|
| 301 | Moved permanently | Changed URLs, site moves, HTTPS |
| 302 | Found (temporary) | Short-term changes, A/B tests |
| 308 | Permanent, keeps method | APIs and forms that must stay POST |
For SEO, use 301 (or 308) for permanent changes so search engines transfer the old page’s signals to the new one.
Example .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]
Redirect 301 /old-page/ /new-page/
Before you upload
- Back up your existing .htaccess. A typo can cause a 500 error.
- Put redirects above WordPress’s own rules.
- Avoid redirect chains (A → B → C); point old URLs straight to the final page.
- Test a few old URLs, and update internal links to the new addresses.
Frequently asked questions
Where is the .htaccess file?
In your website’s root folder (often public_html). It may be hidden, so turn on “show hidden files”.
Does .htaccess work on Nginx?
No. Choose Nginx to get server block rules instead.
How long should I keep redirects?
Google suggests at least a year; keeping them permanently is safest.
Can WordPress do redirects without .htaccess?
Yes, with a redirection plugin, but server rules are faster.
Sources
- Google Search Central: Redirects and Google Search
- Apache: Redirect directive
- Nginx: return directive
Last updated: