簡體   English   中英

多站點網絡管理員,我的站點鏈接到非www網址

[英]multisite network admin , my site link to non-www url

我使用多站點wordpress,昨天我從http更改為https。 起初,我有很多有關更新URL的問題。 所以我重新設計並在MySQL上直接應用了一些方法,例如查詢更改https,設置.htacess,如下所示:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

還對functions.php使用update:

update_option('siteurl','https://www.//example.com');
update_option('home','https://www.example.com');

最終所有鏈接都運行良好。

但是我在Netword管理員菜單上遇到了一個問題

這是我的屏幕:

如何修復網絡管理菜單以顯示https:// www

謝謝

您的網站是MultiSite。 網絡管理員菜單是其中的一部分。

您應該使用update_site_options全局更新URL

另外,請閱讀以下說明,了解如何從HTTP完全轉換為HTTPS

那里有一些亮點:

第一步是啟用SSL進行管理。 這在Wordpress中有很好的文檔說明,只需將以下語句添加到wp-config.php中:

define('FORCE_SSL_ADMIN', true);

第二步是設置相對選項,設置和常量,以啟用對私有瀏覽的可選支持。

define('WP_SITE_URI',($_SERVER["HTTPS"]?"https://":"http://").$_SERVER["SERVER_NAME"]);
define('WP_SITEURI', ($_SERVER["HTTPS"]?"https://":"http://").$_SERVER["SERVER_NAME"]);

您可以根據需要提取域。 本示例假定您的博客位於頂層目錄中。 如果需要,請在最后添加一個子目錄。 然后在“ wp-settings”的include之前插入:

define("WP_CONTENT_URL", WP_SITE_URI . "/wp-content");

然后在包含“ wp-settings”之后添加:

wp_cache_set("siteurl_secure", "https://" . $_SERVER["SERVER_NAME"], "options");
wp_cache_set("home", WP_SITE_URI, "options");
wp_cache_set("siteurl", WP_SITE_URI, "options");

最后一個更改是作為插件實現的。

<?php
/* Plugin Name: Content over SSL
 * Description: Re-write content URIs to use the appropriate protocol
 * Author: Me
 * Version: .1
 */
 
add_filter('the_content', 'my_ssl');
 
function my_ssl($content) {
  if (isset($_SERVER["HTTPS"]))
    $content = ereg_replace("http://" . $_SERVER["SERVER_NAME"], "https://" . $_SERVER["SERVER_NAME"], $content);
  return $content;
}
?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM