0

I am using wordpress with woocommerce and I just got a new domain and I have already migrated the old website to the new domain. My issue is am trying to redirect any one who visited any content on the old domain to the same content on the new domain.

The reason so that if a client visited the old path from an old link he would be redirected to the new domain but not the homepage.

I have tried some htaccess codes but they just redirect the client to new domain homepage.

Thanks

1 Answer 1

1
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomin\.com
RewriteRule ^(.*)$ https://newdomain.com/$1 [R=301,L]
</IfModule>

This is what you're looking for, before the WP block in your .htaccess.

1
  • Thanks a lot, it did do exactly what I was aiming for. Commented Jun 2 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.