发现现在所有大型站点都301到www域名上,主机大师现在只支持两个站之间301重定向,也就是说20个站重定向要做40个站,服务器吃不消,而且根本也没办法管理,一般都是一个站都是绑定www和 @两个域名,希望控制面板支持一键实现@到 WWW或者 WWW到@重定向
您好,可以采用以下办法:一,在网站中正常绑定完所有的域名;二,在网站根目录下创建文件web.config添加内容如下(把域名换为您的域名):<?xml version="1.0" encoding="UTF-8"?><configuration> <system.webServer> <rewrite> <rules> <rule name="hws.com301" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" pattern="^hws.com" /> </conditions> <action type="Redirect" url="http://www.hws.com/{R:0}" /> </rule> </rules> </rewrite> </system.webServer></configuration>
您好,如果方便,请提供服务器登录信息,QQ3007358068
根据你提供的规则文件,完整的文件如下:注意把网址改为你自己的网址
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="/ Z-BlogPHP Imported Rule" stopProcessing="true"> <match url="^.*?" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:0}" /> </rule> <rule name="/ Z-BlogPHP Imported Rule index.php" stopProcessing="true"> <match url="^index.php/.*?" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" /> </conditions> <action type="Rewrite" url="index.php/{R:0}" /> </rule> <rule name="hws.com301" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" pattern="^hws.com" /> </conditions> <action type="Redirect" url="http://www.hws.com/{R:0}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>