How to migrate or map a wordpress site to an existing site's route?

不想你离开。 提交于 2020-07-25 06:08:27

问题


I have a Wordpress blog (blog.xxx.com). I have a nuxt personal website yyy.com which is hosted on aws.

Now I wish to map or migrate the Wordpress blog(blog.xxx.com) to my personal site (yyy.com/blog).

How can we achieve this? Probably yyy.com should show my personal site and yyy.com/blog should take to my blog.

Can I configure this in Wordpress even or what could be the steps to be taken care of?

I tried mapping it to a new domain, but not sure how to map to a particular route and say I visit (yyy.com/blog/{blog-name} likewise.

Any help would be appreciated. Even some guidance or reference would help a lot.

Thank you!


回答1:


Yes, you can set up a WP site in a subfolder of your main website. I don't recommend doing it manually, too much can go wrong. Use a plugin such as Duplicator - it's so simple to use:

  1. Install it on the site to copy and build a package - this packages your entire website into a single zip file
  2. Copy this ZIP file and installer.php to the the hosting new location on your hosting (e.g. yyy.com/blog)
  3. Create a new empty database
  4. Run the installer wizard and make sure the URL in the new settings is https://www.yyy.com/blog

That's it!

You can have the entire site set up & running perfectly in just minutes! it will even set up .htaccess correctly.

No more setting up the database, changing urls in the database, 404 errors, broken links, broken images, etc. Moving a Wordpress site manually can be tricky and you can waste hours trying to fix the issues. Even agencies use a plugin to avoid the problems.




回答2:


If I understood your question correctly, you want to move your WordPress installation from blog.xxx.com to yyy.com/blog, right? There is an official guide for this provided by WordPress: https://wordpress.org/support/article/moving-wordpress/

After you have changed the siteurl and home fields in table wp_options of your database to yyy.com/blog, you can use a plugin like Better Search Replace (https://wordpress.org/plugins/better-search-replace/) that scans your WordPress database and replaces every URL of posts etc. with the new URL of your blog.

In addition, in case of an Apache webserver you need to take care of the .htaccess file and change the RewriteBase to /blog (assuming that it was / before).

Some special plugins (for caching etc.) need some special treatment, but often clearing the cache solves the problem.




回答3:


Well despite Johannes is perfectly clear for me, i'll try to simplify.

  1. Clone WordPress files from blog.xxx.com to yyy.com/blog directory. (not sure how your server is configured, but probably you'll be able to access it.)

  2. Clone Database to new server.

  3. Run sql replace queries

UPDATE wp_options SET option_value = replace(option_value, 'https://blog.xxx.com', 'https://yyy.com/blog') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'https://blog.xxx.com','https://yyy.com/blog');

UPDATE wp_posts SET post_content = replace(post_content, 'https://blog.xxx.com', 'https://yyy.com/blog');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://blog.xxx.com','https://yyy.com/blog');
  1. update your wp-config.php to match your new database.

  2. login to yyy.com/blog/wp-admin

  3. go to settings and update your permalinks



来源:https://stackoverflow.com/questions/62276336/how-to-migrate-or-map-a-wordpress-site-to-an-existing-sites-route

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!