字preSS的.htaccess WWW。不逼preSS、htaccess、WWW

由网友(仄言)分享简介:我试图迫使WWW。在我的网站的所有页面。我有我的主网站(/博客)的文件夹中字preSS安装。在/博客文件夹中有一个.htaccess文件与以下内容:I'm trying to force www. on all the pages of my site. I have wordpress install in a...

我试图迫使WWW。在我的网站的所有页面。 我有我的主网站(/博客)的文件夹中字preSS安装。在/博客文件夹中有一个.htaccess文件与以下内容:

I'm trying to force www. on all the pages of my site. I have wordpress install in a folder on my main site (/blog). In the /blog folder there is an .htaccess file with the following:

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

在该网站的主目录。我有一个.htaccess文件具有如下:

In the main dir of the site. I have a .htaccess file that has the follow:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.sitename.com [NC]
RewriteRule (.*) http://www.sitename.com/$1 [R=301,L]
RewriteRule ^blog/index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/(.*)$ /blog/index.php [L]

在字preSS是可以选择的WWW设置。在WWW。当我直奔出现,除了在每一页上的site.com/blog地址

In wordpress is have the option set for www. The www. appears on every page except the when I go straight the the site.com/blog address

推荐答案

进入设置 - >通用: 字preSS地址(URL) 网站地址(URL)

Go Settings -> General: WordPress Address (URL) Site Address (URL)

和他们都设置为www.yoursite.com(而不是yoursite.com),字preSS自动将负责所有的URL设置为www.yoursite.com,仅此而已。

And set both of them to www.yoursite.com (instead of yoursite.com), wordpress automagically takes care for setting all the urls to www.yoursite.com and that's it.

如果这还不够,你不应该编辑.htaccess文件,无论如何,因为任何时候你保存或重新加载您的永​​久链接设置,字preSS将覆盖您.htaccesss(一些插件可以做到这一点为好) 。

If that isn't enough, you shouldn't edit the .htaccess file anyway, because anytime you save or reload your permalink settings, Wordpress will overwrite your .htaccesss (some plugins may do that as well).

如果你想重写你的网址,你应该 WP重写($ C $做到这一点CX),或者如果你想一点更简单的办法,有一个很好的插件调用重定向(字press.org插件目录)。

If you do want to rewrite your URL, you should do it with WP Rewrite (Codex), or if you want a little more simple approach, there is a good plugin for that called Redirection (Wordpress.org Plugin Directory).

在重定向插件,你可以只设置选项* .mydomain.com / *重定向到www.mydomain.com/*~~V和301,并会照顾你的htaccess的,只要你保持积极的插件

In Redirection plugin you can just set the options to *.mydomain.com/* to redirect to www.mydomain.com/* with a 301, and that will take care of your htaccess as long as you keep the plugin active.

希望这有助于:)

阅读全文

相关推荐

最新文章