简体   繁体   中英

How to write Rewrite rule for full URL in web.config?

I want to write rewrite rule for full URL like

    <rule name="r1" stopProcessing="true">
      <match url="abc.com/man/mostpopulararticles/brides.aspx" ignoreCase="true" />
      <action type="Redirect" url="abc.com/man.aspx" />
    </rule>

is it possible. I have tried but it didn't work for me. Is there any other way to do so. Please help me.

<rule name="r1" stopProcessing="true">
      <match url="^man/mostpopulararticles/brides.aspx$"/>
      <action type="Redirect" url="abc.com/man.aspx" appendQueryString="false" redirectType="Permanent"/>
 </rule>

It will be http:// and abc.com as it is not allowing me to enter the url. Something like this works in my code.

here is the code worked for me:

<rule name="Uk1" stopProcessing="true">
      <match url="^man/mostpopulararticles/brides.aspx" ignoreCase="true" />
  <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{HTTP_HOST}" pattern="^(www.)?abc.co.uk$" />            
      </conditions>
      <action type="Redirect" url="/man.aspx" />
    </rule>

Thanks All

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