2017-07-24 110 views
1

我在更改Wordpress中的網站URL時遇到問題。我不知道我做錯了什麼。 我複製我的網站從fryzjer.make4u.pl。 我創建的子宮demo1.make4u.pl並從fryzjer.make4u.pl拿出我的文件。 當我輸入到demo1.make4u.pl重定向我到fryzjer.make4u.pl。 我在文件的wp-config.php文件更改代碼更改網站URL不起作用Wordpress

<?php 
/** 
* The base configuration for WordPress 
* 
* The wp-config.php creation script uses this file during the 
* installation. You don't have to use the web site, you can 
* copy this file to "wp-config.php" and fill in the values. 
* 
* This file contains the following configurations: 
* 
* * MySQL settings 
* * Secret keys 
* * Database table prefix 
* * ABSPATH 
* 
* @link https://codex.wordpress.org/Editing_wp-config.php 
* 
* @package WordPress 
*/ 
// ** MySQL settings - You can get this info from your web host ** // 
define('WP_HOME','http://demo1.make4u.pl'); 
define('WP_SITEURL','http://demo1.make4u.pl'); 


/** The name of the database for WordPress */ 
define('DB_NAME', 'pawwlak_demo1'); 

/** MySQL database username */ 
define('DB_USER', 'pawwlak_demo1'); 

/** MySQL database password */ 
define('DB_PASSWORD', '*******'); 

/** MySQL hostname */ 
define('DB_HOST', 'localhost'); 

/** Database Charset to use in creating database tables. */ 
define('DB_CHARSET', 'utf8mb4'); 

/** The Database Collate type. Don't change this if in doubt. */ 
define('DB_COLLATE', ''); 


/**#@+ 
* Authentication Unique Keys and Salts. 
* 
* Change these to different unique phrases! 
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} 
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. 
* 
* @since 2.6.0 
*/ 
define('AUTH_KEY',   '2zYYuJ)vQk.)[u9YZN|?nH$%,upKR.|M9LU~Ia?U<xR%_Nkjm-Y(0qCc2+>s[4~f'); 
define('SECURE_AUTH_KEY', '*m0QP$nkR1p(DKM?mQvl5h`yI%8TcdNCE,S!Kdu9I6a~:&Wu/nXV?9pKW1n!&2xw'); 
define('LOGGED_IN_KEY', 'ekZe)[email protected][rux$OB2WH<`B_l*+$[v8:^bNGqjps+kEF!|ENpm5gN<]8)p7cg7QE'); 
define('NONCE_KEY',  'dC1<i[BWhz*T#L(`8P`gz}J2/YA67?~Ps<0g G)@a1N_`Mx+nN^%MW4q)NU;.5/%'); 
define('AUTH_SALT',  'x.zML}$pIbtCGp-/A44kFZB[uLY~;0R9#I0]W~lc9DyLlKU`]HeUSk)$6/(75T}v'); 
define('SECURE_AUTH_SALT', 'dT`KJVh6|xjevK/3:#t3C?IcE0>q%} tFWkT-}I*H60wA|lf);Z1m9bV]G;*qwc/'); 
define('LOGGED_IN_SALT', 'GeDCcC$uR^6e(4(TjF94N$Yh<QIpt_?^q.Ixy{LBW=eez&Ql_7/CqS1r+R;uP+31'); 
define('NONCE_SALT',  'DO.kU/6]s<k<+kfbE`EWf$:f>5G%Q9WPGjE?^0AS3,&OcLfGnY6pgd.orwdq`~C('); 

/**#@-*/ 

/** 
* WordPress Database Table prefix. 
* 
* You can have multiple installations in one database if you give each 
* a unique prefix. Only numbers, letters, and underscores please! 
*/ 
$table_prefix = 'wp_'; 

/** 
* For developers: WordPress debugging mode. 
* 
* Change this to true to enable the display of notices during development. 
* It is strongly recommended that plugin and theme developers use WP_DEBUG 
* in their development environments. 
* 
* For information on other constants that can be used for debugging, 
* visit the Codex. 
* 
* @link https://codex.wordpress.org/Debugging_in_WordPress 
*/ 
define('WP_DEBUG', false); 

/* That's all, stop editing! Happy blogging. */ 

/** Absolute path to the WordPress directory. */ 
if (!defined('ABSPATH')) 
    define('ABSPATH', dirname(__FILE__) . '/'); 

/** Sets up WordPress vars and included files. */ 
require_once(ABSPATH . 'wp-settings.php'); 

你知道它爲什麼這麼想的工作嗎?

+0

您需要通過新的所有表格中,以取代舊的酒莊。 – Bazaim

+0

對不起,我不明白。你能解釋清楚嗎? – Pawwlak

回答

1

您定義了錯誤的常量。您wp-config.php文件的頂部應該是:

define('HOME','http://demo1.make4u.pl'); 
define('SITEURL','http://demo1.make4u.pl'); 

注意WP_HOME成爲HOMEWP_SITEURL成爲SITEURL

另外,如果這並不爲你工作,嘗試連接到數據庫,瀏覽到wp_options表,並調整條目homesiteurl到新網址。

如果你在使用你的數據庫的SQL查詢的信心,你可以利用你的數據庫,如果yuyokk's code作爲一個SQL查詢,將做一個全面的查找/替換:

記住:備份數據庫在嘗試任何SQL查詢之前!

UPDATE wp_options 
SET option_value = 'http://demo1.make4u.pl' 
WHERE option_name = 'home'; 

UPDATE wp_options 
SET option_value = 'http://demo1.make4u.pl' 
WHERE option_name = 'siteurl'; 

UPDATE wp_posts 
SET post_content = REPLACE(post_content,'http://fryzjer.make4u.pl','http://demo1.make4u.pl'); 

UPDATE wp_posts 
SET guid = REPLACE(guid,'http://fryzjer.make4u.pl','http://demo1.make4u.pl'); 
+0

我按照你的寫法制作,它不起作用。你知道我能做什麼嗎? – Pawwlak

+0

仔細檢查你是否指向'wp-config.php'中的正確數據庫 - 是否已切換到新的數據庫?你運行了所有4個SQL查詢嗎?你的數據庫在wp_options-> home下顯示什麼? – Frits

+0

在wp_options-> home下我得到了http://demo1.make4u.pl – Pawwlak