问:我虚拟机IIS的,配置了https,首页打不开,子页能打开、我用了两条thinkphp的一条 规则和https规则打开首页提示301定向次数过多http://www.shuruixin.com 首页就提示定向过多https://www.shuruixin.com/medical/product/cate/id/1.html<?xml version="1.0" encoding="UTF-8"?><configuration> <system.webServer> <rewrite> <rules> <rule name="ThinkPHP_NiPaiYi" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" /> </rule> <rule name="redirect to https" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> <add input="{HTTPS_HOST}" pattern="^(localhost)" negate="true" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" /> </rule> </rules> </rewrite> </system.webServer></configuration>
,https首页提示301定向次数过多
答:您好,虚拟主机设置301跳转https,请参考https://www.west.cn/faq/list.asp?unid=1419
请使用
<rule name="301" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" /> </conditions> <action type="Redirect" url="https://www.abc.com/{R:1}" redirectType="Permanent" /> </rule>
进行跳转即可。
非常感谢您长期对我司的支持!