Website in wordpress redirects to old URL after migration

后端 未结 7 784
离开以前
离开以前 2021-02-05 04:55

I had never done migrating a site on wordpress, I\'ll put step by step how I did, need to put the site on a new domain that are on the same server, so only the migrated files, t

相关标签:
7条回答
  • 2021-02-05 05:12

    You need to make a change to your database. In the database table wp_options (or whatever your database prefix is), you need to change two lines.

    One should be option_id 1, option_name siteurl. Change the option_value from the old url to the new url.

    Similarly there should also be option_id 36, option_name home. Change the option_value also from the old url to the new url.

    This should do the trick. Also check out http://wp.smashingmagazine.com/2013/04/08/moving-wordpress-website/ for the best method to migrate.

    Edit

    In the comments Damon also mentions the issue with re-linking all the images. This for sure can be a right pain, but I suggest this plugin.

    http://wordpress.org/plugins/search-and-replace/

    Just search for the old url and replace with the new one. Before doing this though, make sure you have a backup of the database. You can never guarantee the results when using plugins to mess with your database. But this has always worked for me.

    0 讨论(0)
  • 2021-02-05 05:17

    I've solved my issue with my solution at No# 04 See below what I tried:

    1- Make sure Database wp_option links are set

    /* MySQL: */
    update wp_options set option_value = 'http://example.com' where option_name = 'siteurl';
    update wp_options set option_value = 'http://example.com' where option_name = 'home';
    

    2- Additionally define url in wp-config.php file

    define('WP_HOME','http://example.com');
    define('WP_SITEURL','http://example.com');
    

    3- Clear cache of from server

    4- Clear your browser cache & history (Hurray!!! it solved my issue no redirection)

    On Chrome, Navigate to chrome://settings/clearBrowserData and clear image and file cache.

    0 讨论(0)
  • 2021-02-05 05:18
    define('WP_HOME','domain.com');
    define('WP_SITEURL','domain.com'); 
    

    This goes in your wp-config.php

    Also, be sure to clear your cache and use this script to replace ALL urls in your database.

    https://github.com/interconnectit/Search-Replace-DB

    0 讨论(0)
  • 2021-02-05 05:22

    STILL if nothing works

    GOTO : www.yoursiteurl.com/wp-admin
    ['YES' IT WILL OPEN , if you have migrated correctly]

    GOTO : Settings => General Tab =>

    you will see two fields their

    1. Wordpress Address URL - Enter your site URL
    2. Site Address URL - Enter your site URL

    Make URLs same in Both fields SAVE changes

    Enter your site URL in browser clear cache and reload Yeahhh.... Worked for me

    Enjoy

    Dont forget to modify WP_Options table with your site URL details. Take care my site

    0 讨论(0)
  • 2021-02-05 05:26

    My redirection issue was due to caching. If you do not want to have to clear all your cache and you are using Chrome:

    Right click anywhere on the page > inpect element > Network tab > tick disable cache. Then in that same Chrome tab try to load your website again.

    0 讨论(0)
  • 2021-02-05 05:31

    I think i need to give my contribution! In case you are using Polylang with a dynamic IP, add define('PLL_CACHE_HOME_URL', false); in your wp-config.php and it will solve all your problems (redirection to the former url)!

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