2015-06-10 28 views
0

看代码,这应该是工作去除WWW(其工作的其他网站/子域我的工作)的WordPress的.htaccess不会从网站的网址

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

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 
RewriteRule ^(.*)$ http://%1/ [R] 
</IfModule> 

# END WordPress 

编辑:网站上一个重定向循环现在。

+0

与www重定向对应的规则被注释掉。 –

+1

是不是你的www重写注释掉了?删除'#' – Aravona

+0

等待,我现在记得,评论说,因为它抛出一个“重定向循环” – octohedron

回答

0

固定它进入WordPress的设置>常规>网站网址并加入 “WWW”。到域:)

-1

在WordPress处理请求之前,您的重定向应该是第一次。

这样的:

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

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

# END WordPress