首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Laravel5 iis伪静态写入

Laravel5 iis伪静态写入
EN

Stack Overflow用户
提问于 2021-03-08 16:23:25
回答 1查看 13关注 0票数 0

Nginx的编写方式如下:

代码语言:javascript
运行
复制
location / {
try_files $uri $uri/ /index.php?$query_string;}

我想在iis环境中获得伪静态写入,同样的效果。谢谢你帮我!

EN

回答 1

Stack Overflow用户

发布于 2021-03-11 20:53:41

您可以尝试以下URL重写规则来实现您的要求:

代码语言:javascript
运行
复制
  <configuration>
    <system.webServer>
        <rewrite>
        <rules>
            <rule name="Rule 1" stopProcessing="true">
            <match url="^(.*)/$" ignoreCase="false" />
            <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
            </rule>
            <rule name="Rule 2" stopProcessing="true">
            <match url="^" ignoreCase="false" />
            <conditions>
                <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" />
            </rule>
        </rules>
        </rewrite>
    </system.webServer>
</configuration> 

确保已安装iis URL重写模块。如果没有,你可以从下面的链接下载:

https://www.iis.net/downloads/microsoft/url-rewrite

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66526406

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档