admin管理员组

文章数量:1130349

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

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

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

so all URL will be redirect dynamiccaly.

Is it possible.

Thank you

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

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

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

so all URL will be redirect dynamiccaly.

Is it possible.

Thank you

Share Improve this question edited Jan 9, 2018 at 14:48 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Jan 9, 2018 at 13:18 FlushdrewFlushdrew 91 bronze badge 2
  • wordpress/plugins/redirection ? – kero Commented Jan 9, 2018 at 13:23
  • 1 downvoted since it shows no research. Have you tried to google? have you tried any of the solutions there? – Mark Kaplun Commented Jan 9, 2018 at 13:38
Add a comment  | 

2 Answers 2

Reset to default 0

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\$ [NC]
RewriteRule ^(.*)$ http://NEWDOMAIN [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/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.

Please try to check the below links:

http://www.wpbeginner/beginners-guide/beginners-guide-to-creating-redirects-in-wordpress/

https://stackoverflow/questions/8819706/redirect-all-traffic-to-root-of-another-domain

https://stackoverflow/questions/1945568/htaccess-redirect-all-pages-to-new-domain

https://www.inmotionhosting/support/website/redirects/setting-up-a-301-permanent-redirect-via-htaccess

https://stackoverflow/questions/15362458/redirect-all-pages-to-new-domain

https://stackoverflow/questions/3255967/htaccess-redirect-all-requests-to-different-domain

http://www.orderofbusiness/blog/redirect-old-domain-to-new-domain-via-htaccess/

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

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

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

so all URL will be redirect dynamiccaly.

Is it possible.

Thank you

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

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

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

so all URL will be redirect dynamiccaly.

Is it possible.

Thank you

Share Improve this question edited Jan 9, 2018 at 14:48 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Jan 9, 2018 at 13:18 FlushdrewFlushdrew 91 bronze badge 2
  • wordpress/plugins/redirection ? – kero Commented Jan 9, 2018 at 13:23
  • 1 downvoted since it shows no research. Have you tried to google? have you tried any of the solutions there? – Mark Kaplun Commented Jan 9, 2018 at 13:38
Add a comment  | 

2 Answers 2

Reset to default 0

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\$ [NC]
RewriteRule ^(.*)$ http://NEWDOMAIN [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/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.

Please try to check the below links:

http://www.wpbeginner/beginners-guide/beginners-guide-to-creating-redirects-in-wordpress/

https://stackoverflow/questions/8819706/redirect-all-traffic-to-root-of-another-domain

https://stackoverflow/questions/1945568/htaccess-redirect-all-pages-to-new-domain

https://www.inmotionhosting/support/website/redirects/setting-up-a-301-permanent-redirect-via-htaccess

https://stackoverflow/questions/15362458/redirect-all-pages-to-new-domain

https://stackoverflow/questions/3255967/htaccess-redirect-all-requests-to-different-domain

http://www.orderofbusiness/blog/redirect-old-domain-to-new-domain-via-htaccess/

本文标签: htaccessRedirect a WP to another with all URL