如何重定向wordpress网站与ssl非www从www上运行
问题描述:
我正在运行一个网站,computergk.com托管在Windows azure和ssl(从Windows azure)上安装它。我想将www版本的网站重定向到非www。现有的web.config配置如下:如何重定向wordpress网站与ssl非www从www上运行
<?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认证中心提供的Windows Azure SSL。请帮帮我。
感谢
答
开放的.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]
没有.htaccess文件。有web.config文件。 –