i'm bad at redirection so i'm asking you.

I have my old site with some posts like www.oldsite.com/category/my-awesome-post, www.oldsite.com/category/my-awesome-post-2 ...

I would like to redirect each URL to a new domain like www.newsite.com/category/my-awesome-post

so all URL will be redirect dynamiccaly.

Is it possible.

Thank you


If you want 301/302 redirect sitewide my suggestion is to use .htaccess file, but that's not a good practice at all. Anyway the code should be something like this

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^OLDDOMAIN\.com$ [NC]
RewriteRule ^(.*)$ http://NEWDOMAIN.com [R=301,L]

Note: Change the R=301 to whatever you would want where R=301 would mean permanent redirect and R=302 would mean temprorary redirect.

If you want to migrate your site to a new wp install on another domain, you need to use the WP Migrate DB plugin that can be found here : https://wordpress.org/plugins/wp-migrate-db/

The plugin do a really dirty job of replacing every single url in your db with a new one, which by hand is not really cool process.. You then need to import the db via phpMyAdmin or other interface to the new place and change all static links on the pages if there are any.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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