我正在运行一个网站,在windows azure上托管的computergk.com和安装在它上面的ssl(来自windows azure)。我想将网站的www版本重定向到非www。现有的web.config配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress: http://computergk.com"
patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile"
negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory"
negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule></rules>
</rewrite>
</system.webServer>
</configuration>
我已将域名的www cname记录转发给@。我正在使用Godaddy Class 2 Certification Authority提供的Windows Azure SSL。请帮帮我。
由于
答案 0 :(得分:0)
打开.htaccess并添加此行
RewriteEngine On
#Force non-www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.computergk\.com [NC]
RewriteRule ^(.*)$ https://computergk.com/$1 [L,R=301]
# redirect http to https all domain
RewriteCond %{HTTPS} off
RewriteRule (.*) https://computergk.com%{REQUEST_URI} [R=301,L]