【问题标题】:Convert htacces rules to web.config将 htaccess 规则转换为 web.config
【发布时间】:2014-12-11 14:54:58
【问题描述】:

需要转换这个htaccess:

Options -Indexes
RewriteEngine on
RewriteBase /dir1/dir2/dir3
RewriteRule ^(.*)$ myscript.php [L]

到 IIS 网络服务器的 web.config 文件。 我试过这个:

<configuration>
<system.webServer>
<directoryBrowse enabled="true" />
<defaultDocument enabled="true">
<files>
<add value="myscript.php" />
</files>
</defaultDocument>
</system.webServer>
</configuration>

但是这个配置只使 myscript.php 成为一个索引文件。重写基础怎么样?

【问题讨论】:

    标签: asp.net .htaccess iis iis-7 web-config


    【解决方案1】:

    好吧,也许您可​​以尝试文件的完整路径...

    <add value="/dir1/dir2/dir3/myscript.php" />
    

    希望对你有所帮助!

    顺便说一句,检查您使用的路径... 路径前的第一个反斜杠应该意味着您指向磁盘根目录

    【讨论】:

    • 抱歉,我的意思是你的配置文件的添加标签...我编辑了帖子!
    • 不,它不起作用我做了 并得到 403 错误
    猜你喜欢
    • 2015-07-27
    • 1970-01-01
    • 2013-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-22
    • 2015-02-17
    相关资源
    最近更新 更多