在PHP中的web.config中重写查询字符串url [英] Rewrite query string url in web.config in PHP

查看:117
本文介绍了在PHP中的web.config中重写查询字符串url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重定向网址来自
http://example.com/page -name /?id = 45 http://example.com/page-name/45 IIS中的web.config中的

如何为web.config编写规则?

I want to redirect url From http://example.com/page-name/?id=45 to http://example.com/page-name/45 in web.config in IIS. How can I write it's rule for web.config?

推荐答案

我使用下面的代码

<rule name="Redirect to url" stopProcessing="true">
    <match url=".*" />
        <conditions>
        <add input="{HTTP_HOST}" pattern="^page-name/([^/]+)/?$" />
            </conditions>
        <action type="Redirect" url="page-name/?id={R:0}" redirectType="Permanent" />
 </rule>

但如果我使用此代码,我将收到404错误。这段代码有什么问题?

but I am getting 404 Error if I use this code. what is the problem in this code?

这篇关于在PHP中的web.config中重写查询字符串url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆