![](/img/trans.png)
[英]404 error and redirect after moving wordpress site from live to localhost
[英]Moving WordPress from Live to Localhost
我正在嘗試將實時網站移動到本地主機以進行測試,但無法加載該網站。 當我轉到 localhost:8888/example 時,我的瀏覽器無限期地加載頁面並且只顯示一個空白頁面。
我從實時遷移到本地所采取的步驟來自本教程
配置 wp-config.php
define('DB_NAME', 'myDatabase'); define('DB_USER', 'myUserName'); define('DB_PASSWORD', 'myPassword'); define('DB_HOST', 'localhost:8888');
導航到 localhost:8888/example
然后,什么也沒有發生。
這是apache_error.log的結果
[Wed Jul 25 08:08:14 2018] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 25 08:08:14 2018] [notice] Digest: done
[Wed Jul 25 08:08:14 2018] [notice] FastCGI: process manager initialized (pid 14761)
[Wed Jul 25 08:08:14 2018] [notice] Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.1 mod_ssl/2.2.34 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0 configured -- resuming normal operations
[Wed Jul 25 08:13:48 2018] [notice] caught SIGTERM, shutting down
[Wed Jul 25 08:13:56 2018] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 25 08:13:56 2018] [notice] Digest: done
[Wed Jul 25 08:13:56 2018] [notice] FastCGI: process manager initialized (pid 15305)
[Wed Jul 25 08:13:56 2018] [notice] Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.1 mod_ssl/2.2.34 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0 configured -- resuming normal operations
...以及 php_error.log 的結果
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 15:10:59 Europe/London] PHP Notice: icit_srdb::recursive_unserialize_replace(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Requests_Utility_CaseInsensitiveDictionary" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Applications/MAMP/htdocs/far/srdb.class.php on line 755
[25-Jul-2018 14:12:35 UTC] PHP Warning: require_once(/Applications/MAMP/htdocs/example/gd-config.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/example/wp-config.php on line 84
[25-Jul-2018 14:12:35 UTC] PHP Fatal error: require_once(): Failed opening required '/Applications/MAMP/htdocs/example/gd-config.php' (include_path='.:/Applications/MAMP/bin/php/php7.2.1/lib/php') in /Applications/MAMP/htdocs/example/wp-config.php on line 84
將 WP 從本地主機遷移到實時遷移(反之亦然)的最簡單方法是使用插件
https://wordpress.org/plugins/all-in-one-wp-migration/
您導出所有內容,創建 WP 的本地版本,安裝插件,然后使用此插件從實時頁面導入先前導出的 wpress 文件,然后當您完成后,確認永久鏈接兩次,就是這樣
它將遷移您的代碼以及您的數據庫
您也可以使用“復制器插件”。 這非常容易和快速。
請參閱以下鏈接... https://wordpress.org/plugins/duplicator/
我按照janmyszkier說明解決了這個問題。 首先,我將 gd-config.php 添加到正確的目錄中。 其次,我按照這些說明糾正了瀏覽器錯誤 SSL_ERROR_RX_RECORD_TOO_LONG。
更新:這讓我的網站在本地啟動並運行,但解決 SSL 錯誤的方法僅限於沒有 JavaScript 功能,因為它創建了一個不安全的 SHA-1 證書。
我修復了 SSL_ERROR_RX_RECORD_TOO_LONG。
更新 wp_tnxo_options SET option_value = replace(option_value, ' http://westerp7.local ', ' http://localhost:81/westerp7 ') WHERE option_name = 'home' OR option_name = 'siteurl'; 更新 wp_tnxo_posts SET post_content = replace(post_content, ' http://westerp7.local ', ' http://localhost:81/westerp7 '); 更新 wp_tnxo_postmeta SET meta_value = replace(meta_value,' http://westerp7.local ',' http://localhost:81/westerp7 ');
然后從這里:
安全,https 上線時,網站不會在 XAMPP 中打開復制為 http
將此代碼添加到您的 config-wp.php 文件中:
定義('FORCE_SSL',假); 定義('FORCE_SSL_ADMIN',假);
定義('WP_HOME',' http://localhost/sitename '); 定義('WP_SITEURL',' http://localhost/sitename ');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.