An HTTP redirect tells browsers and search engines that a resource has another address. Use a temporary redirect while checking the destination, then use a permanent redirect once the move is final. Choose exact page rules when you do not want every path below a directory to move.
These instructions apply where the web server supports Apache-compatible .htaccess rules. Native NGINX does not read this file. A CDN or reverse proxy can also affect the request seen by the origin server. Keep File Manager or SFTP available so you can restore the previous file if a rule prevents browser access.
IN THIS ARTICLE
01 Redirect one exact page
- Back up the current file and identify the complete old and new URLs, including HTTPS and the preferred hostname.
- Place the following temporary test rule before the application's general routing rules. Replace both example paths and the destination domain.
RewriteEngine On
RewriteRule ^oldpage\.html$ https://example.com/newpage.html [R=302,L]
After confirming the move is permanent, change R=302 to R=301. A permanent redirect can be cached, so avoid using it during trial-and-error testing. If the old URL contains a query string, decide whether it should be kept; the rule above normally preserves the existing query string.
02 Verify the redirect
- Open the old URL in a private browser window and confirm the final destination and page content.
- Check the HTTP response with a developer network panel or a command such as
curl -I https://example.com/oldpage.html. Confirm the expected status and Location header. - Test the new URL directly and check that it does not redirect back to the old one. Update your menus, canonical tags and internal links to the final URL.
Can I use one page redirect rule for a whole-site move?
A rule that moves every path needs a destination site that supports those paths. Redirecting every missing page to the home page can confuse users and search engines. Map valuable pages individually, preserve useful query parameters, and avoid forwarding login tokens or other secrets in URLs. If an error appears, restore the previous file and inspect the server log.