Need help in Domain redirection

I've a main domain //.tv as main domain and I also have few more domains with the extention of .net, .eu, .info and more. I would like to open the main domain site with all other domain.

  • Adam Czajczyk
    • Support Gorilla

    Hello GiaNet Media

    I hope you're well today!

    I remember that we discussed that subject a bit over a month ago here:

    https://premium.wpmudev.org/forums/topic/aliases-domains-to-master-site-with-wordpress-multisite-installation-not-correctly-redirect

    I'm afraid not much has changed since there and not much can be done here if you want this additional domains to behave like the original domain (with all the permalinks properly adjusted/handled etc).

    A "quick and dirty" workaround would be to set regular redirects so whenever someone visits "additionaldomain.net" they are simply 301 or 302 redirected via .htaccess to the "maindomain.com". This, however, has a downside of that the main site will not be visible under "additionaldomain.net" URL but under it's original domain - it will be a regular, "classic" redirect. In other words, that won't be domain "masking" or "mapping", just a simple redirect.

    Making the main site fully handle and be available under multiple domains at the same time - especially if these same domains' sub-domains are used as mapped on sub-sites - would require some, most likely quite serious, changes to WP core but Core changes are never recommended as they might cause serious security and compatibility issues and would be overwritten upon updates. Furthermore, I'm afraid I'm not even able to estimate the kind and amount of such changes so it's a bit of a "guess" and I can't guarantee that it's possible at all.

    I realize that this is something that sounds like a really simple thing to achieve and I admit it would be quite easy with any static site and could probably be done sometimes (at least it was possible) with a simple single WP installs - we discussed that previously - but it's a sub-domain Multisite which makes the entire thing much more complex. While I'd really love to say otherwise, I must say I didn't come across any new/other working and tested solution since our last discussion.

    That being said, if a simple .htaccess 301/302 redirect is something that would work good enough for you, I believe we could help you with it so just let me know.

    Kind regards,
    Adam

  • GiaNet Media
    • Site Builder, Child of Zeus

    Hi, thanks for the reply.
    I think that WordPress or the domain mapping plugin need to implement the condition to masking, like alias, also the second level domain...
    So, can I do the redirect 301 from cPanel, or I can do the redirection only from .htaccess?

  • GiaNet Media
    • Site Builder, Child of Zeus

    Hi Adam,
    I'm trying to make the redirect 301 from the cPanel. But it doesn't work, I have always the same issue.
    If I write the inonda.biz or inonda.net URLs the URL change into http://inonda.tv/wp-signup.php?new=inonda.biz
    At the same, if I want to enter into cPanel with the official URL http://cpanel.inonda.tv, I'm redirecting to the wp-signup.php page...

    I want to remember you that in cPanel, for the domain mapping, I have created the wildcard same as *.inonda.net and *.inonda.biz.

    What can I do to solve it?

  • GiaNet Media
    • Site Builder, Child of Zeus

    Hi Adam,
    I'm trying to make the redirect 301 from the cPanel. But it doesn't work, I have always the same issue.
    If I write the inonda.biz or inonda.net URLs the URL change into http://inonda.tv/wp-signup.php?new=inonda.biz
    At the same, if I want to enter into cPanel with the official URL http://cpanel.inonda.tv, I'm redirecting to the wp-signup.php page...

    I want to remember you that in cPanel, for the domain mapping, I have created the wildcard same as *.inonda.net and *.inonda.biz.

    What can I do to solve it?

  • GiaNet Media
    • Site Builder, Child of Zeus

    Hi Adam,
    I'm trying to make the redirect 301 from the cPanel. But it doesn't work, I have always the same issue.
    If I write the inonda.biz or inonda.net URLs the URL change into http://inonda.tv/wp-signup.php?new=inonda.biz
    At the same, if I want to enter into cPanel with the official URL http://cpanel.inonda.tv, I'm redirecting to the wp-signup.php page...

    I want to remember you that in cPanel, for the domain mapping, I have created the wildcard same as *.inonda.net and *.inonda.biz.

    What can I do to solve it?

  • GiaNet Media
    • Site Builder, Child of Zeus

    Hi Adam,
    I'm trying to make the redirect 301 from the cPanel. But it doesn't work, I have always the same issue.
    If I write the inonda.biz or inonda.net URLs the URL change into http://inonda.tv/wp-signup.php?new=inonda.biz
    At the same, if I want to enter into cPanel with the official URL http://cpanel.inonda.tv, I'm redirecting to the wp-signup.php page...

    I want to remember you that in cPanel, for the domain mapping, I have created the wildcard same as *.inonda.net and *.inonda.biz.

    What can I do to solve it?

  • Adam Czajczyk
    • Support Gorilla

    Hello GiaNet Media

    I'm not exactly sure how/what rules cPanel set but it must be a 301 (or 302 - temporary) redirect instead of alias and it must only redirect the domain but not any sub-domain - otherwise it will cause issues.

    Taking into account that you got a wild-card sub-domain for those additional domains, I believe they are as add-on domains in cPanel. In such case they have the root folder set to be the same as the root folder of the main domain. Is that correct?

    This is important because if above is true, setting up redirect via cPanel for these additional domains will not work and instead you'd need a strict rule in the main .htaccess of the site, I think.

    I think instead of cPanel redirects you could try adding this to the main .htaccess of your site:

    RewriteCond %{HTTP_HOST} ^inonda.biz [nc]
    RewriteRule ^(.*)$ http://inonda.tv/$1 [r=301,nc]

    Make sure that it's added right below the

    RewriteBase /

    line and above all the other lines there.

    According to the .htaccess tester that seems to be doing proper redirects, redirecting only the main domain but not any subdomain. I'm not quite sure how it will "play" with your setup but it's worth giving a try - just make sure please that there's no other redirects set in cPanel for that.

    Let me know if that worked for you, please.

    Best regards,
    Adam

  • GiaNet Media
    • Site Builder, Child of Zeus

    Taking into account that you got a wild-card sub-domain for those additional domains, I believe they are as add-on domains in cPanel. In such case they have the root folder set to be the same as the root folder of the main domain. Is that correct?

    Yes, that is correct.

    RewriteCond %{HTTP_HOST} ^inonda.biz [nc]
    RewriteRule ^(.*)$ http://inonda.tv/$1 [r=301,nc]

    I have tried to add this code into the .htaccess below the RewriteBase / line and above all the other lines there, but it don't work. It redirect all domains URLs, included the main url inonda.tv, into a hosting "500" page...

  • Adam Czajczyk
    • Support Gorilla

    Hello GiaNet Media

    line and above all the other lines there, but it don't work. It redirect all domains URLs, included the main url inonda.tv, into a hosting "500" page...

    The scenario here is a bit unusual so it might need some "special treatment". It's possible that some other rules from .htaccess or something set on server or even the "site configuration itself" is interrupting. I admit that this "500" error is something that bothers me as the rules that I shared seem to work fine/as expected when tested with .htaccess tester.

    Would you be able to make a quick additional test and see how it behaves with Domain Mapping plugin temporarily disabled? Could you also share entire .htaccess with me so I could take a look at that as well?

    Kind regards,
    Adam

  • Adam Czajczyk
    • Support Gorilla

    Hello GiaNet Media

    Thanks for sharing .htaccess and I'm sorry for keeping you waiting.

    The order of the rules in .htaccess is important, especially if there's "L" flag used which means "last" (so no other rule after it is processed). This line is also invalid as it's causing an URL to be "messed up" a bit after it's rewritten:

    RewriteRule ^/?$ "http\:\/\/inonda\.tv\/" [R=301,L]

    For example:

    "http://inonda.net" would become "http://inonda.net/http:\/\/inondia\.tv\/"

    which will cause wrong redirect and might result in 500 error.

    I've attached a txt file to this post. It's basically your .htaccess just slightly "cleaned up" (from commented out rules, for clarity) and changed. Try using content of that file as your .htaccess and see if that works. Please just make sure that you still do have a copy of your current one in case you'd need to restore it.

    If that doesn't help, I'm afraid I'm out of ideas here. The rules should work but there's to many additional aspects that might be involved like e.g. the fact that .htaccess is set to also inherit any rules/rewrites from any .htaccess from parent folders, possible interference from plugins or even some specific aspects of the webserver configuration on your server.

    I'm pretty sure that that kind of redirect that we discussed here should be doable with .htaccess but it might require much more complex rules but if that adjusted .htaccess doesn't work either you might want to consider hiring a pro experienced in advanced .htaccess rules creation and Apache configuration to help you with that.

    Kind regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.