Redirect website to new domain preserving URL paths

One of our customers in Oxford asked to redirect a website hosted on an Apache web server to a new domain while preserving existing web page paths.

For example, if someone went to the URL:
https://www.old_website.com/products/product_689.html
They would be automatically redirected to:
https://www.new_website.com/products/product_689.html

This can be done by adding a single line to the website’s .htaccess file:

Redirect 301 / https://www.new_website.com/

Redirect 301 / https://www.new_website.com

Don’t forget to restart the Apache service for changes to take effect.

Leave a Reply

Your email address will not be published. Required fields are marked *

Share the Post:

Related Posts