redirection

Discussion in 'DNS/Domain names' started by GygerPeter, Feb 23, 2016.

  1. Hi

    My Blogengine Site is in the Folder "Domain.net/blogengine".

    What can i do, that everybody the call "Domain.net" is redirected to "Domain.net/blogengine"?

    I put a file "web.config" in the root. But i made something wrong and i get a error message
    *** web.config ***
    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("domain.net") ) > 0 Then
    Response.Redirect("/blogengine")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("blog.domain.net") ) > 0 Then
    Response.Redirect("/blogengine")
    End If
    %>

    The Error Msg:
    Error Code 0x8007000d
    Config Error Configuration file is not well-formed XML

    Thank you for your help
    Greetings
     
  2. ComputerMan

    ComputerMan Winhost Staff

    Remove the code you added into your web.config file. That code belongs in a ASP page or ASP.NET page. It won't work in the web.config file.

    Instead add the following code into your web.config file:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="Rewrite to blogengine" stopProcessing="true">
                        <match url=".*" />
                        <conditions>
                            <add input="{HTTP_HOST}" pattern="^(www.)?Domain.net$" />
                            <add input="{PATH_INFO}" pattern="^/blogengine/" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="\blogengine\{R:0}" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
    BTW I got the code from Scott Forsyth's Blog
     
    Elshadriel and Michael like this.
  3. Thank you for your correction

    Now it work's.

    And thank you too for the Suggestion to read the blog from Scott Forsyth.
     
    ComputerMan and Michael like this.

Share This Page