Rewrite query string url in web.config in PHP

558 Views Asked by At

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?

1

There are 1 best solutions below

1
On BEST ANSWER

I am using below code

<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 am getting 404 Error if I use this code. what is the problem in this code?