How to rewrite URL to a subdomain

Discussion in 'Server Operation' started by ocxtox0m, May 3, 2023.

  1. ocxtox0m

    ocxtox0m New Member

    My domain, xyzcom, is set to the xyz folder.

    I don't want to create a new subdirectory in my root directory; instead, I want to access the same folder via demo.xyzcom/user.xyzcom/anything.xyzcom.
    Internal pages for a URL like demo.xyz.com should be demo.xyzcom/folder1/home.aspx, for example.
    Thank you. Please provide any fake code you may have if you have it.
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Does that URL "demo.xyzcom/user.xyzcom/anything.xyzcom." make sense? Strange conconction it looks to me.
    Use subdomain. ISPConfig Manual states:
     
  3. ocxtox0m

    ocxtox0m New Member

    thanks for suggest me
     
  4. ocxtox0m

    ocxtox0m New Member

    For a URL rewrite I need support.mydomain.com to point to mydomain.com/support. What I have is rewriting to support.mydomain.com/support.

    I've tried 2 different variations, but no luck. Any help is greatly appreciated.

    Version 1

    <rewrite>
    <rules>
    <rule name="rewrite support" enabled="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAny">
    <add input="{HTTP_HOST}" pattern="^support.mydomain.com$" />
    </conditions>
    <action type="Rewrite" url="\support\{R:0}" />
    </rule>
    </rules>
    </rewrite>

    Version 2

    <rule name="Support Rule" stopProcessing="false">
    <match url="(.*)" />
    <conditions> also check this out Apartments for rental in Keserwan
    <add input="{HTTP_HOST}" pattern="^(?!www)(\w+)\.mydomain\.com$" />
    </conditions>
    <action type="Rewrite" url="{C:1}/{R:1}" />
    </rule>
     
    Last edited: May 12, 2023
  5. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Are you using ISPConfig? I ask because I do not see where rules you show in #4 could be used.
    Or have you already tried setting it up with ISPConfig Panel, creating subdomain for website and the redirect does not work? If this is the case, show screenshot of the redirect configuration and specify how it does not work.
    If there are further problems, I suggest you read the ISPConfig manual.
     
    ahrasis likes this.
  6. ocxtox0m

    ocxtox0m New Member

    <rewrite>
    <rules>
    <rule name="rewrite support" enabled="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAny">
    <add input="{HTTP_HOST}" pattern="^support.mydomain.com$" />
    </conditions>
    <action type="Rewrite" url="\support\{R:0}" />
    </rule>
    </rules>
    </rewrite>
     
  7. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    So you are not using ISPConfig. You should not have posted your guestion on ISPConfig forum. There is Linux forums where your question is suitable.
    If you were using ISPConfig, there is Redirect Tab on website settings, and subdomain or aliasdoman for website, these should cover redirecting setups.
     
    ahrasis likes this.
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    I've moved the post to the general Linux forum now.
     
    ahrasis likes this.

Share This Page