Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 27852

Rewrite host name always get error 404

$
0
0

Hi, What seems to be something very easy at first, is now bugging me for hours.

I want every request to : http(s)://name.sub.domain.com to be rewritten to : http(s)://name.domain.com.

Here's the web.config file content in C:\inetpub\wwwroot:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <urlCompression doDynamicCompression="true" />
        <rewrite>
            <rules>
                <rule name="Rewrite URL with hostname without the sub-domain." enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{CACHE_URL}" pattern="^(https?)://" />
                    </conditions>
                    <serverVariables>
                    </serverVariables>
                    <action type="Rewrite" url="{C:1}://name.domain.com/{R:1}" logRewrittenUrl="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

According to what i understand of this module it should do it. But when i enable the rule i always get : 404 - File or directory not found.

If i try to go directly to http;//name.domain.com or https;//name.domain.com it works fine.

I have enabled the Failed Request Log and according to it the rule applied correctly.

Thanks to anyone who might help.


Viewing all articles
Browse latest Browse all 27852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>