Just Rewrite URL not working

I am trying to configure the IIS Rewrite service URL to just send any url request to google (as a test):

<rule name="Intercept" enabled="true" patternSyntax="ECMAScript" stopProcessing="true"> <match url="(.*)" /> <action type="Rewrite" url="google-homepage-url-here" appendQueryString="false" logRewrittenUrl="true" /> <conditions> <add input="{HTTP_HOST}" pattern="example.com$" /> </conditions> </rule> 

I use Rewrite rather than Redirect because I need to hide the URL from the user. The above configuration works for Redirect, but not for Rewrite, why is this?

When I clicked http://example.com/blablabla , I get 404.4

My goal is to redirect the user to the google homepage.

I have ARR installed, any ideas?

+5
source share
1 answer

If you want the user to be directed to the Google homepage, you should use redirection, not rewrite. This is not "hiding the url from the user", but server-side processing.

Without any logs, I can only assume that your IIS is trying to rewrite to google, asks for it on some non-existent page, and obviously returns 404. This can happen if your site uses http and the google server uses https, eg.

I think that you should also check the difference between forwarding and rewriting, this article is a good start.

+3
source

All Articles