$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'); ?>customization - Wordpress broken after domain name change|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)

customization - Wordpress broken after domain name change

matteradmin9PV0评论

I configured my Wordpress site to use a new domain name. I'm still using the same hosting provider. I have also set-up the old domain to redirect to the new one. Now, the thing I want to achieve is that I want to remove, from the site, all references to the old domain. However, whenever I point my browser to

new_domain/admin

it gets redirected to

.php?redirect_to=https%3A%2F%2Fold_domain%2Fwp-admin%2F&reauth=1

If I point my browser to

old_domain/wp-login

it thinks that I'm requesting files in a directory named /wp-login and so gives me "Page not found" error of my site. But if I do

old_domain/wp-login.php

it displays the login form but on submit, I get redirected to

.php?wpe-login=true

And finally, when I login, the url changes to

/

The other problem is that the theme is completely broken. I've inspected the html source whose <link> and <script> tags call resources from old_domain/path/to/resource/

I have tried all the solutions there are out there. Among those are:

  1. changing the site and wordpress url from the dashboard settings.
  2. applying search and replace all instances of to in the database.
  3. trying the define( 'RELOCATE', true ); method; it sets the wordpress url to
  4. in here When moving a WP site, why does wp-admin redirect to old site?, I found these define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']); define('WP_SITEURL', WP_HOME . '/');. Applied them thinking this would fix it as I'm not hard-coding any urls. But these, too, set both the site and wordpress url to

Can anyone point me in the right direction?

I didn't need to move the database or the Wordpress installation around as I didn't change hosting provider. So, as a last resort, would it be a good idea to delete the wordpress installation and reinstall it with all the themes in place?

I configured my Wordpress site to use a new domain name. I'm still using the same hosting provider. I have also set-up the old domain to redirect to the new one. Now, the thing I want to achieve is that I want to remove, from the site, all references to the old domain. However, whenever I point my browser to

new_domain/admin

it gets redirected to

https://old_domain/wp-login.php?redirect_to=https%3A%2F%2Fold_domain%2Fwp-admin%2F&reauth=1

If I point my browser to

old_domain/wp-login

it thinks that I'm requesting files in a directory named /wp-login and so gives me "Page not found" error of my site. But if I do

old_domain/wp-login.php

it displays the login form but on submit, I get redirected to

https://old_domain/wp-login.php?wpe-login=true

And finally, when I login, the url changes to

https://old_domain/wp-admin/

The other problem is that the theme is completely broken. I've inspected the html source whose <link> and <script> tags call resources from old_domain/path/to/resource/

I have tried all the solutions there are out there. Among those are:

  1. changing the site and wordpress url from the dashboard settings.
  2. applying search and replace all instances of https://old_domain to http://new_domain in the database.
  3. trying the define( 'RELOCATE', true ); method; it sets the wordpress url to http://old_domain
  4. in here When moving a WP site, why does wp-admin redirect to old site?, I found these define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']); define('WP_SITEURL', WP_HOME . '/');. Applied them thinking this would fix it as I'm not hard-coding any urls. But these, too, set both the site and wordpress url to http://old_domain

Can anyone point me in the right direction?

I didn't need to move the database or the Wordpress installation around as I didn't change hosting provider. So, as a last resort, would it be a good idea to delete the wordpress installation and reinstall it with all the themes in place?

Share Improve this question asked Jan 11, 2019 at 16:50 GeorgeGeorge 11 bronze badge 2
  • See wordpress.stackexchange/questions/157883/… – WebElaine Commented Jan 11, 2019 at 19:02
  • 1 Also, make sure you check in an Incognito window or completely clear your browser cache before trying to reach the new URL. Browsers cache redirects and that may be the final gotcha. – WebElaine Commented Jan 11, 2019 at 19:03
Add a comment  | 

1 Answer 1

Reset to default 1

I'd use a Search/Replace plugin (I like "Better Search and Replace") to change all instances of 'olddomain' to 'newdomain'.

Then I would look at the wp-options table to ensure the new URL is in there (in two places). I'd remove any URL-based settings in the wp0config.php file. (I never change those.)

I'd also check the htaccess file in the new site's root folder to ensure that it isn't doing any redirects or rewrites to the old URL.

Then, using a new browser instance (a private one insures caching/cookies aren't an issue), I'd try the new URL. If needed, use the browser Developer Tools (usually F12; or right-click and 'Inspect') and look at the Network tab to ensure all requests are for the new URL

Post a comment

comment list (0)

  1. No comments so far