「網站日誌」- 從192.192.246.169(獨立主機)轉移至wells.fgchen.com(虛擬主機)
2018/2/16 (農曆春節1/1)
心血來潮,將Wordpress從一台主機移到另一台主機(之前想做沒做,把原本獨立主機再挪出來另作他用),步驟:
- 將Wordpress網站建立tar ball, tar -xvf wp.tar ./wp/8
- 使用wget,將網站tar檔複製到新位置
- 解tar ball
- 將資料庫中所有的表格以SQL方式匯出,檔案太大,則進mysql,以soruce wp.sql方式進行匯入。
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');出現404 not found, 接著處理.htaccess,變更目錄 (由舊目錄改成新目錄)
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wp RewriteRule ^(.*/)?w3tc_rewrite_test([0-9]+)/?$ $1?w3tc_rewrite_test=1 [L] RewriteCond %{HTTP:Accept-Encoding} gzip RewriteRule .* - [E=W3TC_ENC:_gzip] RewriteCond %{HTTP_COOKIE} w3tc_preview [NC] RewriteRule .* - [E=W3TC_PREVIEW:_preview] RewriteCond %{REQUEST_METHOD} !=POST RewriteCond %{QUERY_STRING} ="" RewriteCond %{REQUEST_URI} /$ RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass|w3tc_logged_out|wordpress_logged_in|wp RewriteCond "%{DOCUMENT_ROOT}/wp/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_in RewriteRule .* "/wp/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC </IfModule> # END W3TC Page Cache core # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wp RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wp/index.php [L] </IfModule>舊網站Wiki也搬移完畢! http://www.x.ita.hk.edu.tw/wiki 下關鍵字:cpanel performance tuning找到一堆效能調整文章,確有成效!