0

I have figured out URL Rewrite is probably broken hence why i have another problem with it redirecting DNS my IT is giving me so i made a very simple test case which doesn't work either so i am trying to fix this issue currently appearing on a production server.

I created a host file redirect

127.0.0.1 test.useless.com

Ran a ping and it resolve properly. So i created a simple redirect rule for redirecting that name to google.

<rule name="something" stopProcessing="false">
    <match url="(.*)" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="*/test.useless.com/*" />
    </conditions>
    <action type="Redirect" url="http://www.google.ca/" redirectType="Permanent" />
</rule>

So this match whatever url with http://test.useless.com/ right now i don't care about any page i keep it simple. Ran the rewrite test window and copy pasted that url and ran the test and it pass. The Redirect then should send to google.ca.

Why nothing works. There is no log in IIS for this anywhere the URL Rewrite rule in on root node of IIS and i have sites with that Hostname in it.

Franck
  • 125
  • 1
  • 1
  • 9

1 Answers1

0

I think the pattern field in the condition must be a regular expression, so something like:

test\.useless\.com

A regular expression can't start with a *, that's a quantifier for the previous character.

Peter Hahndorf
  • 14,058
  • 3
  • 41
  • 58
  • The pattern works when i put `http://test.useless.com/` but still doesn't redirect to google. – Franck Jan 11 '21 at 18:26
  • I think the `http_host` variable would have a value of `test.useless.com` without http – Peter Hahndorf Jan 11 '21 at 18:49
  • Still doesn't work. Anyhow i need the slashes as i will need it later to differenciate between the sub domain and the main domain – Franck Jan 11 '21 at 18:55