I am running a website, computergk.com hosted on windows azure and ssl (from windows azure) installed on it. I want to redirect the www version of the website to non-www. The existing web.config configuration is below:
<?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>
I have already forwarded www cname record of my domain to @. I am using Windows Azure SSL provided by Godaddy Class 2 Certification Authority. Please help me.
Thanks
Open .htaccess and add this line
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]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.