Wordpress 中的 WWW 链接重定向到主页

发布于 2024-09-15 16:28:18 字数 1116 浏览 3 评论 0原文

我最近将我工作的网站更新为 Wordpress 3.0。一些奇怪的事情开始发生,现在 www.已从 URL 中消失,如果您添加 www.到 URL(现有硬编码链接的很大一部分都有它),然后它会将您重定向到主页 URL。

有什么想法可能导致这种情况吗?

我的 .htaccess 看起来像是 WordPress 3.0 多用户的默认设置

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
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]

我的 wp-config.php 中与多用户相关的设置是

/** Multi User */
define('WP_ALLOW_MULTISITE', true);

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'xxxx.ca' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

我的域的 URL 设置只是 xxxx.ca,没有 www。在它的前面。

I've recently updated a website I work on to Wordpress 3.0. Something strange has started happening, where now the www. has dissapeared from the URLs, and if you add the www. to the URL (a good portion of the existing hardcoded links have it) then it redirects you to the home page URL.

Any ideas what could be causing this?

My .htaccess looks like the default for Wordpress 3.0 Multi-User

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
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]

The settings in my wp-config.php related to the multi-user are

/** Multi User */
define('WP_ALLOW_MULTISITE', true);

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'xxxx.ca' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

The URL settings for my domain is just the xxxx.ca, theres no www. infront of it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

り繁华旳梦境 2024-09-22 16:28:18

你的 .htaccess 里有什么?像这样的吗?:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

该重定向块会从所有 URL 中删除 www。

仪表板/设置/常规中的站点 URL 设置是什么?他们有www吗?您是否在 wp-config.php 中配置了站点 URL?

What's in your .htaccess? Anything like this?:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

That redirect block strips the www from all URLs.

And what are the site URL settings in Dashboard/Settings/General? Do they have the www? And do you have site URLs configured in wp-config.php?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文