301 редирект на хостинге Windows — если нет доступа к Internet Services Manager
Надо править файл web.config
Вот рабочий код
<configuration> <system.webServer> <rewrite> <rules> <rule name="Redirect to WWW" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{https_HOST}" pattern="^oldsite.ru$" /> </conditions> <action type="Redirect" url="https://www.newsite.ru/{R:0}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> </configuration>