-1

if i enter this url in browser address bar http://localhost:8800/gb then page load and url in address bar become like this one http://localhost:8800/gb/default.aspx

but if i enter this url http://localhost:8800/gb/ in browser address bar then getting error.

all i want is if i enter this url http://localhost:8800/gb/ in browser address bar the it should redirect me to default.aspx page. so if url ends with /gb/ or /us/ anything two character with two front slash then default.aspx should be loaded.

so far i have used these below url rewrite rule.

<rule name="Always redirect root extensionless path to index.aspx" stopProcessing="true">
      <match url="^$" />
      <action type="Redirect" url="/Default.aspx" appendQueryString="true" logRewrittenUrl="true" />
</rule>

<rule name="Rewrite rule for Redirecting countries" stopProcessing="true">
    <match url=".*.aspx" />
    <conditions trackAllCaptures="true">
      <add input="{REQUEST_URI}" pattern="[a-z]{2}/(.*)" />
    </conditions>
    <action type="Rewrite" url="/{tolower:{C:1}}" appendQueryString="false" logRewrittenUrl="true" />
</rule>

so please guide me with one more rule which can handle this url http://localhost:8800/gb/ and redirect to default.aspx of site root.

thanks

Thomas
  • 33,544
  • 126
  • 357
  • 626

1 Answers1

0

this rule worked for my scenario.

when url is http://localhost:53741/gb/ then below rule redirect to this url http://localhost:53741/gb/default.aspx

<rule name="redirect two character to default" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
          <add input="{URL}" pattern="^/[a-z]{2}(/)?$" />
      </conditions>
      <action type="Redirect" url="default.aspx" appendQueryString="false" />
</rule>
Thomas
  • 33,544
  • 126
  • 357
  • 626