我有一个网站,这是通过宝塔盒托管。我有一个关于写.htacess文件以强制域名的www部分的问题。我正在尝试让域名强制www并将其包括在内。
域名当前未使用www部分,即使.htaccess文件似乎强制使用:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.gopagoda.com$ [OR]
RewriteCond %{HTTP_HOST} ^wwww.domain.gopagoda.com$
RewriteRule (.*)$ http://www.domain.com/$1 [R=301,L]
Redirect 301 /copy_index.html http://www.domain.com
# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>我是.htaccess文件编辑的新手,我看过很多教程,但我没有看到任何使用上面这种语法的教程。四个w (wwww)?
任何帮助都将不胜感激!非常感谢!
最好的,摩根
发布于 2013-12-18 13:39:13
检查你的WP固定链接设置,确保你的网站和博客地址都有 www 。
然后将您的规则更改为:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(wwww\.)?domain\.gopagoda\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L,NE]
RewriteRule ^copy_index\.html$ / [R=301,L,NC]
# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPresshttps://stackoverflow.com/questions/20650393
复制相似问题