2016-03-16 40 views
0

我正在從事一個項目,涉及從A點到B點遷移WordPress安裝。它應該相當簡單,但是手動或基於插件的傳輸都不起作用。解釋:WordPress遷移到不正確的路徑損壞的子域

A點是'demo.com'的一個相當標準的安裝,我試圖將它遷移到一個子域(B點),比如'c.example.com'。當然,我可以遷移代碼,插件,主題等等,但是當我將數據庫引入時,一切都變得不合時宜(並且我更新了數據庫中的網站URL /主頁URL /某些永久鏈接結構)。

的代碼從<head>標籤內的片段展示了一些有趣的信息:

<link rel="stylesheet" id="parent-style-css" href="http://c.#wp-content/themes/Example_theme/style.css?ver=4.4.2" type="text/css" media="all"> 
<link rel="stylesheet" id="style-css-css" href="http://c.#wp-content/themes/Example_theme/style.css?ver=4.4.2" type="text/css" media="all"> 
<link rel="stylesheet" id="layout-css" href="http://c.#wp-content/themes/Example_theme/css/layout.css?ver=4.4.2" type="text/css" media="all"> 
<link rel="stylesheet" id="main-css" href="http://c.#wp-content/themes/Example_theme/css/main.css?ver=4.4.2" type="text/css" media="all"> 
<link rel="stylesheet" id="shortcodes-css" href="http://c.#wp-content/themes/Example_theme/css/shortcodes.css?ver=4.4.2" type="text/css" media="all"> 
<link rel="stylesheet" id="mediaelement-css" href="http://c.#wp-includes/js/mediaelement/mediaelementplayer.min.css?ver=2.18.1" type="text/css" media="all"> 
<link rel="stylesheet" id="prettyPhoto-css" href="http://c.#wp-content/themes/Example_theme/css/prettyPhoto.css?ver=4.4.2" type="text/css" media="all"> 
<link rel="stylesheet" id="responsive-css" href="http://c.#wp-content/themes/Example_theme/css/responsive.css?ver=4.4.2" type="text/css" media="all"> 
<link rel="stylesheet" id="instag-slider-css" href="http://c.#wp-content/plugins/instagram-slider-widget/assets/css/instag-slider.css?ver=1.2.1" type="text/css" 

更仔細地看,你可以看到在href /路徑不包含「example.com」的域名,而是用「#」代替。

http://c.#wp-content/themes/Example_theme/css/responsive.css?ver=4.4.2 

還注意到,我已經更新了WP-config文件來定義WP_HOME和WP_SITE的URL,這沒有任何影響。 htaccess的也被修正爲子域(其還沒有作用),它讀取:

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /c/ 
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . //index.php [L] 
</IfModule> 

# END WordPress 

這樣做的原因似乎是在數據庫內某處,但有可能是一個文件的地方,是控制這個。

任何援助是值得歡迎的,非常感謝。

再次感謝您與我的問題。

回答

0

首先,從頭開始嘗試。清理所有的子域文件&數據庫。然後,將所有example.com文件複製到子域。之後,導出所有SQL數據庫(與wp安裝相關)&將其導入到子域的數據庫中。

後在這些線路是編輯的wp-config.php文件&把相關信息:

define('DB_NAME', 'your_db_name'); 
/** MySQL database username */ 
define('DB_USER', 'your_subdomains_db_user'); 

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

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

... 

$table_prefix = 'your_subdomain_db_table_prefix'; 

該操作後,使用這個腳本https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

所有你需要做的就是把它複製到你的子域名,訪問它的主文件&用它將「example.com」的所有db條目替換爲「c.example.com」。

就是這樣,在此之後,您應該在您的子域中擁有全功能的example.com WP副本。

此外,您可以閱讀手抄本瞭解更多信息https://codex.wordpress.org/Moving_WordPress