简体   繁体   English

为什么.htaccess / Web.Config文件在Windows服务器上不起作用?

[英]Why .htaccess / Web.Config file is not working on windows server?

My .htaccess file is all working in localhost. 我的.htaccess文件全部在localhost中运行。 Did I make the site live then there htaccess is not working. 我是否使站点处于活动状态,然后htaccess无法正常工作。 And my live server is Windows server not the linux server 我的实时服务器是Windows服务器,而不是Linux服务器

I have used this site for htaccess to web config converter htaccess to webconfig link 我已经将该网站用于htaccess到web配置转换器htaccess到了webconfig链接

.htacess code .htacess代码

RewriteEngine on
RewriteRule  ^index.html$  index.php [NC,QSA]
RewriteRule  ^enquiry.html$  enquiry.php [NC,QSA]

Web Config Code 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>

I have own solve this Bcoz my the IIS 7 is helping me for this and 我自己解决了这个问题,IIS 7正在帮助我解决这个问题,

Your can use the config and rewrite and all rule set in the rules then you got the answer for htaccess is working in webconfig 您可以使用config和rewrite以及规则中的所有规则集,然后得到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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM