简体   繁体   中英

IIS redirect inserting double forward slash

Can't seem to work out why the following is resulting in a double slash being added:

<rule name="GenericRemoveDotASPX" stopProcessing="true">
    <match url="(.*).aspx(.*)" />
    <action type="Redirect" url="{R:1}{R:2}" appendQueryString="true" redirectType="Permanent"  />
</rule>

Using the above rule if I enter (the first part is {R:1} www.blah.com/blah and the 2nd part is {R:2} /blah):

www.blah.com/blah.aspx/blah

the browser is redirected to:

www.blah.com/blah//blah

However if I enter:

www.blah.com/blah.aspxblah

the browser is redirected to:

www.blah.com/blahblah

How can I stop this duplicate forward slash from being present in the redirect?

It seems that the issue was only present when run locally in Visual Studio 2017.

When installed on a test and production server the double forward slash was not present... how bizarre.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM