Home  >  Q&A  >  body text

WordPress ignores new site URL and home page when hosted on another domain

I have the following setup for my client:

Wordpress is hosted at siteground.com with externalhost.com/blog => A valid Wordpress installation.

AWS application "myapp.com" managed by Amplify, rewriting /blog should point to externalhost.com/blog, but user myapp.com/blog is shown.

Then I switched siteurl and home in the wp-config.php file:

define( 'WP_SITEURL', 'https://myapp.com/blog' );
define( 'WP_HOME', 'https://myapp.com/blog' );

It almost works, but there are some cases where it doesn't work. What I've noticed so far: Pagination within the page section holds the link to the next page externalhost.com/blog. The menu section link redirects to the externalhost.com/blog section.

It feels like not all links are changing everywhere in WordPress, especially in pagination, and I can't find a solution. Maybe someone out there is experiencing the same behavior or thoughts that I can change?

P粉269530053P粉269530053251 days ago374

reply all(1)I'll reply

  • P粉186897465

    P粉1868974652024-01-17 13:18:37

    When switching website URLs or moving the site to new hosting etc. I find that I need to do a search and replace in the database, this can be done using the following plugin: https://wordpress.org/plugins /better-search-replace/ Search the old url externalhost.com< /code> and replace it with the new url myapp.com This should solve your problem, the plugin usually allows you to Conduct a test run before making changes.

    Another way to do migration is to use a plugin, for example: https://wordpress.org/plugins/all-in-one-wp-migration/

    After you are finished using the plugins, you should be able to remove them from the project

    reply
    0
  • Cancelreply