Skip to main content
Copied code from comments
Source Link
MrWhite
  • 43.1k
  • 4
  • 50
  • 90

We recently replaced most of our default pages from default.htm to default.asp.

Rewrite rules work fine if it's a sub-folder, e.g. example.com/help/default.asp where the default.htm was deleted. If I type domain.com/help/default.htm, it correctly shows the new .asp page and no 404 because the default.htm no longer exists.

At the root entering example.com/default.htm does not redirect to default.asp instead sending the user to the 404 page we created.

Tried exact match vs. wildcard, no difference.

Why the 404 and no redirect?

<rule name="homepage" patternSyntax="Wildcard" stopProcessing="true">
<match url="*example.com/default.htm" ignoreCase="true" />
<action type="Redirect" url="http://www.example.com/default.asp" redirectType="Permanent" /><>
</rule>

UPDATE: This works on a subfolder redirect from htm to asp:

<rule name="downloadhome" patternSyntax="Wildcard" stopProcessing="true">
<match url="*download/default.htm" ignoreCase="true" />
<action type="Redirect" url="/download/default.asp" redirectType="Permanent" />
</rule>

We recently replaced most of our default pages from default.htm to default.asp.

Rewrite rules work fine if it's a sub-folder, e.g. example.com/help/default.asp where the default.htm was deleted. If I type domain.com/help/default.htm, it correctly shows the new .asp page and no 404 because the default.htm no longer exists.

At the root entering example.com/default.htm does not redirect to default.asp instead sending the user to the 404 page we created.

Tried exact match vs. wildcard, no difference.

Why the 404 and no redirect?

<rule name="homepage" patternSyntax="Wildcard" stopProcessing="true">
<match url="*example.com/default.htm" ignoreCase="true" />
<action type="Redirect" url="http://www.example.com/default.asp" redirectType="Permanent" /></rule>

We recently replaced most of our default pages from default.htm to default.asp.

Rewrite rules work fine if it's a sub-folder, e.g. example.com/help/default.asp where the default.htm was deleted. If I type domain.com/help/default.htm, it correctly shows the new .asp page and no 404 because the default.htm no longer exists.

At the root entering example.com/default.htm does not redirect to default.asp instead sending the user to the 404 page we created.

Tried exact match vs. wildcard, no difference.

Why the 404 and no redirect?

<rule name="homepage" patternSyntax="Wildcard" stopProcessing="true">
<match url="*example.com/default.htm" ignoreCase="true" />
<action type="Redirect" url="http://www.example.com/default.asp" redirectType="Permanent" />
</rule>

UPDATE: This works on a subfolder redirect from htm to asp:

<rule name="downloadhome" patternSyntax="Wildcard" stopProcessing="true">
<match url="*download/default.htm" ignoreCase="true" />
<action type="Redirect" url="/download/default.asp" redirectType="Permanent" />
</rule>
Tweeted twitter.com/StackWebmasters/status/1100500922281668612
added 10 characters in body
Source Link
SKidd
  • 47
  • 7

We recently replaced most of our default pages from default.htm to default.asp.

Rewrite rules work fine if it's a sub-folder, e.g. example.com/help/default.asp where the default.htm was deleted. If I type domain.com/help/default.htm, it correctly shows the new .asp page and no 404 because the default.htm no longer exists.

At the root entering example.com/default.htm does not redirect to default.asp instead sending the user to the 404 page we created.

Tried exact match vs. wildcard, no difference.

Why the 404 and no redirect?

<rule name="homepage" patternSyntax="Wildcard" stopProcessing="true">
<match url="*example.com/default.htm" ignoreCase="true" />
<action type="Redirect" url="*exampleurl="http://www.example.com/default.asp" redirectType="Permanent" /></rule>

We recently replaced most of our default pages from default.htm to default.asp.

Rewrite rules work fine if it's a sub-folder, e.g. example.com/help/default.asp where the default.htm was deleted. If I type domain.com/help/default.htm, it correctly shows the new .asp page and no 404 because the default.htm no longer exists.

At the root entering example.com/default.htm does not redirect to default.asp instead sending the user to the 404 page we created.

Tried exact match vs. wildcard, no difference.

Why the 404 and no redirect?

<rule name="homepage" patternSyntax="Wildcard" stopProcessing="true">
<match url="*example.com/default.htm" ignoreCase="true" />
<action type="Redirect" url="*example.com/default.asp" redirectType="Permanent" /></rule>

We recently replaced most of our default pages from default.htm to default.asp.

Rewrite rules work fine if it's a sub-folder, e.g. example.com/help/default.asp where the default.htm was deleted. If I type domain.com/help/default.htm, it correctly shows the new .asp page and no 404 because the default.htm no longer exists.

At the root entering example.com/default.htm does not redirect to default.asp instead sending the user to the 404 page we created.

Tried exact match vs. wildcard, no difference.

Why the 404 and no redirect?

<rule name="homepage" patternSyntax="Wildcard" stopProcessing="true">
<match url="*example.com/default.htm" ignoreCase="true" />
<action type="Redirect" url="http://www.example.com/default.asp" redirectType="Permanent" /></rule>
Source Link
SKidd
  • 47
  • 7

IIS7 rewrite rule triggers 404 rather than redirecting to new pagw

We recently replaced most of our default pages from default.htm to default.asp.

Rewrite rules work fine if it's a sub-folder, e.g. example.com/help/default.asp where the default.htm was deleted. If I type domain.com/help/default.htm, it correctly shows the new .asp page and no 404 because the default.htm no longer exists.

At the root entering example.com/default.htm does not redirect to default.asp instead sending the user to the 404 page we created.

Tried exact match vs. wildcard, no difference.

Why the 404 and no redirect?

<rule name="homepage" patternSyntax="Wildcard" stopProcessing="true">
<match url="*example.com/default.htm" ignoreCase="true" />
<action type="Redirect" url="*example.com/default.asp" redirectType="Permanent" /></rule>