Weird issue with subdomains

Discussion in 'General' started by Valeren, Nov 30, 2023.

  1. Valeren

    Valeren New Member

    Hi, before posting here we've read a ton of guides / watched many and many tutorials.
    ISPConfig 3.2.11, brand new installation for a VPS that will manage just one site.

    Our target should be plain simple: we have a "crm" dir under web (so /web1/web/crm/) and we want to create a subdomain crm. example. com pointing there.
    Every guide illustrates how to do it in two simple steps:
    1) create an A record to the subdomain (was already on since days, we have an external DNS)
    2) create an active subdomain to /crm/ with an L redirect, so:
    Host: crm
    Domain: the only domain
    Redirect Type: L
    Redirect Path: /crm/
    Active: checked

    Pretty easy, but it never ever worked for us.
    Calling crm. example. com always, and I mean always redirects to www. example. com

    The weird issue: we tried debugging and checked the vhosts.
    The first thing we noticed was that never, under any circumstance, a vhost for the subdomain was being created.
    The second thing was that, inside the vhost file for the only site, a specific ServerAlias from the subdomain to www was present:
    ServerAlias crm. example. com
    The third thing was that said record was being removed if the subdomain was deleted and viceversa, meaning that ISPC purposefully added/removed it.

    We decided to avoid altering the vhosts manually to avoid disasters and to post here.
    Is there anything we should do or change? Config options, procedures, whatever?
    Thanks in advance!
     
  2. pyte

    pyte Well-Known Member HowtoForge Supporter

    You could just create a webspace with crm.domain.tld instead of creating a subdomain in ISPConfig.

    If you don't provide the webspace for domain.tld on this server than just add the domain "crm.domain.tld" and create a webspace for "crm.domain.tld" instead of "domain.tld" and creating a subdomain.
     
    till likes this.
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Creating a website for the subdomain like @pyte suggested is the recommended way, having multiple applications in the same vhost or directory tree of the same vhost is never a good option.

    Another alternative is to create a vhost subdomain in ISPConfig. You can enable vhost subdomains under system > interface config. But creating a website is a better way.

    And finally, if you get redirect to www.domain.tld, then you must either have added such a redirect in the website cms that is in the web root, or in the crm, or you have configured a SEO redirect on the redirect tab of the website. But this does not really matter in the end as the correct solution to your original problem is to create a website or vhost subdomain.
     
    ahrasis likes this.
  4. Valeren

    Valeren New Member

    Thanks you, we managed to successfully create subdomains using vhost but other issues emerged.
    Since they are unrelated, I'll open another dedicated thread.
    Thanks again!
     

Share This Page