$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>htaccess - Redirect a WP to another with all URL|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

htaccess - Redirect a WP to another with all URL

matteradmin9PV0评论

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/

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far