How to map or copy a wordpress site to a subfolder in an existing site's route?

前端 未结 3 1915
南笙
南笙 2020-11-28 15:09

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)

相关标签:
3条回答
  • 2020-11-28 15:18

    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.

    0 讨论(0)
  • 2020-11-28 15:36

    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.

    0 讨论(0)
  • 2020-11-28 15:43

    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

    0 讨论(0)
提交回复
热议问题