Я не эксперт в, переписывают правила, но возвращение одного шага - удостоверяются, что Ваш каталог Apache conf не имеет
AllowOverride None
поскольку это отключит Ваш .htaccess полностью.
Решение проблемы заключалось в том, чтобы оба доменных имени (mysite.com и www.mysite.com) явно были настроены в Azure как пользовательские домены.
Затем, чтобы использовать модуль перезаписи URL в IIS (уже установленный в Azure), добавив раздел rewrite в файл Web.config:
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="WWW Rewrite" stopProcessing="true" enabled="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www[.](.+)" />
</conditions>
<action type="Redirect" url="http://{C:1}/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
I believe this is NOT a DNS job, you may make www as CNAME for mydomain.com but still, the www will show up in the URL
If you're using Apache2 or any webserver capable of reading and executing an .htaccess file you can use the code below :
<IfModule mod_rewrite.c>
# Enable Rewrite Engine
# ------------------------------
RewriteEngine On
RewriteBase /
# Add or remove www. Whichever you prefer.
# This one removes which seems to be the favourable choice these days.
# ------------------------------
RewriteCond %{HTTP_HOST} ^www.mydomain.com
RewriteRule (.*) http://mydomain.com/$1 [R=301,L]
</IfModule>