为什么.htaccess/Web.Config文件在Windows服务器上不工作?
问题描述:
我的.htaccess文件都在localhost中工作。我让网站生活,然后在那里htaccess不工作。而我活服务器是Windows服务器不是Linux服务器为什么.htaccess/Web.Config文件在Windows服务器上不工作?
我已经使用这个网站的htaccess到web配置转换器htaccess to webconfig link
.htacess代码
RewriteEngine on
RewriteRule ^index.html$ index.php [NC,QSA]
RewriteRule ^enquiry.html$ enquiry.php [NC,QSA]
Web配置代码
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<rule name="rule 1o">
<match url="^index.html$" ignoreCase="true" />
<action type="Rewrite" url="/index.php" appendQueryString="true" />
</rule>
<rule name="rule 2o">
<match url="^enquiry.html$" ignoreCase="true" />
<action type="Rewrite" url="enquiry.php" appendQueryString="true" />
</rule>
</system.web>
</configuration>
答
我有自己解决这个Bcoz我的在IIS 7中帮助我,这和
您可以使用配置和重写,所有规则中的规则设置,那么你得到了htaccess的答案是webconfig工作
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="MyRule">
<match url="index.html" />
<action type="Rewrite" url="/index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
我觉得你的问题是真的:“为什么我的Web.Config代码不工作?” – MrWhite
@ w3d如果你知道解决方案请帮助我... :) –
不幸的是我不知道Web.Config(IIS)语法。 (我被.htaccess引用吸引了你的问题。)然而,你的代码与你链接到的工具的输出不一样,它包括'url =“/ enquiry.php” - 你缺少斜杠字首。 (?) – MrWhite