[英]how to redirect wordpress website with ssl to non-www from www running on azure
我正在運行一個網站,computergk.com托管在Windows azure和安裝在其上的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證書頒發機構提供的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]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.