I have the following set up for a client:
WordPress hosted at siteground.com with externalhost.com/blog
=> working WordPress Installation.
AWS App “myapp.com” managed by Amplify with a rewrite for /blog which should lead to externalhost.com/blog
but show the user myapp.com/blog
.
I then switched the siteurl and home in the wp-config.php
file:
define( 'WP_SITEURL', 'https://myapp.com/blog' );
define( 'WP_HOME', 'https://myapp.com/blog' );
It pretty much works, but there are some cases which aren’t working. So far I have noticed:
Pagination in the pages section keeps the links for the next page with externalhost.com/blog
.
Menu Section links redirect to the externalhost.com/blog
part.
It feels that not everywhere in the WordPress the link has changed above all in the pagination I wasn’t able to find a solution. Maybe someone has experienced the same behaviour or ideas where I can modify those behaviours?
2
Answers
I got it working, doing the following in the wp-config.php
Now it works.
Reference: Change value of $_SERVER['HTTP_HOST'] on Bitnami Wordpress behind Azure CDN
When switching the site url or moving the site to new hosting etc I have found i need to do a search & replace in the DB which can be done with a plugin like: https://wordpress.org/plugins/better-search-replace/ search for the old url
externalhost.com
& replace with the new urlmyapp.com
this should resolve your issue, the plugin usually allows you to do a dry run before making the changes.Also a another way to do a migration is also use a plugin like: https://wordpress.org/plugins/all-in-one-wp-migration/
Once your done with the plugins you should be able to remove them from your project