0
votes

I trying to build a rewrite rule to "Permanent Redirect" of a PHP page to MVC site. here is the URL of PHP site /Home/new-age-xxx.php & url of MVC site to which I want user to redirect "/home/new-age-xxx"

here is my URL rewriting rule

<rule name="Imported Rule 1-599" stopProcessing="true">
     <match url="^home\new/-age/-xxx\.php$" ignoreCase="false" />
     <action type="Redirect" url="/home/new-age-xxx" appendQueryString="false" redirectType="Permanent" />
</rule>

It is not redirecting to /home/new-age-xxx, even i tried to move it to other urls like /login/index

Any suggestion?

Thanks

1
Learn how to write correct regular expressions and also how to troubleshoot, docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/…Lex Li

1 Answers

0
votes

You could use a bewlo url rewrite rule to redirect one site url to another site:

e.g:

Request URL: http://www.sample2.com/home/new-age-123.php

Redirect url:http://www.example.com/home/new-age-123

 <rule name="reg redirect" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{REQUEST_URI}" pattern="/home/new\-age\-([0-9]{1,3}).php$" />
                </conditions>
                <action type="Redirect" url="http://www.example.com/home/new-age-{C:1}" appendQueryString="false" />
            </rule>

enter image description here

To learn more about url rewrite module you could refer the bewlo link:

Creating Rewrite Rules for the URL Rewrite Module

Regards, Jalpa