Rewrite url query string in web.config in PHP

I want to redirect a 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 this rule for web.config?

+3
source share
1 answer

I am using the code below

<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>

but I get 404 error if I use this code. what is the problem in this code?

+2
source

All Articles