Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

alias domain wildcard redirect

Discussion in 'General Discussion' started by tortuga, Oct 22, 2018.

  1. tortuga

    tortuga Member

    Joined:
    Oct 16, 2018
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United Kingdom
    cPanel Access Level:
    Website Owner
    I have a site that I want some other domains to redirect to, with wildcards. What I'm finding is that if I add them as alias domains, the wildcard does not work, but if I add them as add-on domains, it does. Is this to be expected? Is there any way to get wildcard redirects working with alias domains?

    Thanks
     
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,464
    Likes Received:
    505
    Trophy Points:
    263
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @tortuga

    Can you tell me how you're implementing the wildcard redirect? An example would be fantastic. I'd like to see if I can replicate it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. tortuga

    tortuga Member

    Joined:
    Oct 16, 2018
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United Kingdom
    cPanel Access Level:
    Website Owner
    I'm just using the redirect facility in cPanel, but not the one within the alias domain screen, as it doesn't give you an option for wildcards (maybe because it doesn't work). Instead I use the main redirect screen. I have also tried manually entering a redirect in the htaccess using %{REQUEST_URI} instead of $ but it still doesn't work.

    I think what may be happening is that there is a default redirect in place for alias domains, as it redirects to the main domain even if a redirect has not been specified, and that this prevents a wildcard redirect to the same domain from working.
     
  4. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,464
    Likes Received:
    505
    Trophy Points:
    263
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @tortuga


    I'm a bit confused, if you point the alias to the folder for the wildcard domain it shouldn't need a redirect.

    By default the alias domain is going to essentially be parked on whatever domain's folder you point it to upon creation. If you're using the primary domain's folder (public_html) then yes it's going to display that information - if you use the wildcard domain's folder it negates the necessity to redirect it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. tortuga

    tortuga Member

    Joined:
    Oct 16, 2018
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United Kingdom
    cPanel Access Level:
    Website Owner
    Not sure what you mean by wildcard domain? You mean the one it's redirecting to?

    The behaviour I'm getting is that if I don't specify a redirect for the alias domain, then the top level will redirect to the main domain, but not any subpages. Say my main domain is example1.com. Create alias example2.com, no redirect specified.

    example2.com redirects to example1.com fine.
    example2.com/sub-page/ does not redirect at all

    If I do create a wildcard redirect, then there is no difference.
     
  6. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,464
    Likes Received:
    505
    Trophy Points:
    263
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    I believe I am not fully understanding what you're trying to do which is why I requested an example originally. I think we're talking about two different kinds of wildcards. Keep in mind I don't know what your configuration looks like.

    It seems you're talking about redirecting all files/folders in your site using cPanel >>Domains >> redirects -> then selecting "Wild Card Redirect"

    Am I correct?

    If that's the case, essentially an Alias is already a redirect in a way - it's an alias of the domain it's added to so I'm not understanding why you're not aliasing it to the original domain. For example:

    Lets say I have domain1.com and domain2.com If I want all files and folders in domain2.com to redirect to domain1.com I'll add domain2.com as an addon domain then redirect it using the wildcard redirect. But if I want to add it as an alias domain I'll just do the following assuming domain1.com is the primary and its document root is public_html:

    domain2.com.png

    This means that all data for domain1.com will display for domain2.com as well.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. tortuga

    tortuga Member

    Joined:
    Oct 16, 2018
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United Kingdom
    cPanel Access Level:
    Website Owner
    Yes. And like I say, on my cPanel, the top level of an alias domain redirects to the main domain even without a redirect specified. But I think you've answered my question, that if you want a wildcard redirect from one domain to another, the source domain has to be an addon, yes? You cannot do that from an alias domain?
     
  8. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,464
    Likes Received:
    505
    Trophy Points:
    263
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    That's really not the purpose of an alias domain so it does make sense it's not working for you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice