kahymo Posted January 1, 2021 Share Posted January 1, 2021 (edited) hi guys i need a script i can use on a website that redirect all domains to a specific URL+domain so here is the goal to achieve: i want to redirect DOMAIN1.com DOMAIN2.org DOMAIN3.com .... to my main domain MyredirectDomainurl.com and on MyredirectDomainurl.com i need to run a script that will FORWARD DOMAIN1.com ===> https://www.afternic.com/domain/DOMAIN1.COM DOMAIN2.ORG ===> https://www.afternic.com/domain/DOMAIN2.ORG DOMAIN3.com ===> https://www.afternic.com/domain/DOMAIN3.com thanks for your help Hal Edited January 1, 2021 by kahymo typo Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/ Share on other sites More sharing options...
gw1500se Posted January 1, 2021 Share Posted January 1, 2021 This is not really a PHP question. You need to create a .htaccess file with redirect. You can see how here. Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583582 Share on other sites More sharing options...
kahymo Posted January 1, 2021 Author Share Posted January 1, 2021 thanks @gw1500se but in the htaccess is more redicrect to internal pages how to redirect all traffic from DOMAIN_Origin.com to a constructed URL like https://www.afternic.com/domain/DOMAIN_Origin.com ?? Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583583 Share on other sites More sharing options...
benanamen Posted January 1, 2021 Share Posted January 1, 2021 How about giving us a high level overview of what you have going on and the real problem you are trying to solve by doing this. Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583584 Share on other sites More sharing options...
requinix Posted January 1, 2021 Share Posted January 1, 2021 2 hours ago, kahymo said: but in the htaccess is more redicrect to internal pages Doesn't have to be. You can tell it to redirect however and wherever you want. Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583585 Share on other sites More sharing options...
kahymo Posted January 1, 2021 Author Share Posted January 1, 2021 Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583586 Share on other sites More sharing options...
kahymo Posted January 1, 2021 Author Share Posted January 1, 2021 (edited) the htaccess code will be hosted on the root of MyRedirectDomain.com as show in the illustration how to catch the origin domain in a variable and reuse it for the destination the use is to forward 100 or 10K domains to one website, and have them all redirected to a specific parking page Edited January 1, 2021 by kahymo Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583587 Share on other sites More sharing options...
requinix Posted January 2, 2021 Share Posted January 2, 2021 But why redirect and then redirect again? Why not just have domain1.com redirect to the place you want instead of some other place you don't want? Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583592 Share on other sites More sharing options...
kahymo Posted January 2, 2021 Author Share Posted January 2, 2021 (edited) @requinix is it easy to bulk redirect hundreths/thousands domain to the target domain if you redirect one by one, it is hunndreths/thousands redirect inside these registrar backoffice who can be take anything from 1 minutes upto 3 minutes per redirect so after it is setup, it take 15min to redirect all the domains versus a few hours/days to process each domain one by one Edited January 2, 2021 by kahymo Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583598 Share on other sites More sharing options...
requinix Posted January 2, 2021 Share Posted January 2, 2021 Isn't that more complicated than it needs to be? Point each domain's DNS to some web server you control and have it issue the redirects. One place for everything. Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583599 Share on other sites More sharing options...
kahymo Posted January 2, 2021 Author Share Posted January 2, 2021 @requinix, that's an alternative solution but require a server, which i don't have right now i think some developpers should be able to write a simple htaccess and index.php code that do just that with one domain Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583601 Share on other sites More sharing options...
Solution requinix Posted January 2, 2021 Solution Share Posted January 2, 2021 30 minutes ago, kahymo said: but require a server, which i don't have right now What? Sure you do: that second server you were planning to use. The one where the domains redirect to, and where you were going to redirect from. Take that, add a virtualhost for a catch-all domain (so any domain that doesn't match some other known site), then give it a redirect to go to destinationtarget.com/(requested domain). It's one configuration that handles the redirects for every single domain you throw at it - assuming you all want them to use the same pattern for the redirect. Then you change the DNS for the domains you want to redirect from such that they resolve to that second server. Browser will look up "domain1.com" or "domain2.com" or "domain3.com", all of them resolve to that second server, browser asks the server for the webpage at that domain, server responds with a redirect to destinationtarget.com. In fact, that "second server" can simply be whatever server hosts destinationtarget.com. I mean, this redirect business is very lightweight. It's not going to add any noticeable load to anything. So there. You have a server that hosts destinationtarget.com. Give it a new configuration for a catch-all domain that does the redirect I said, then update the domains to point to that server. And if you decide to handle some redirected domains differently then you don't have to update DNS for anything. Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583602 Share on other sites More sharing options...
benanamen Posted January 2, 2021 Share Posted January 2, 2021 17 hours ago, kahymo said: the use is to forward 100 or 10K domains to one website, and have them all redirected to a specific parking page Oh, so your a Domain Squatter. 🚩🚩 Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583616 Share on other sites More sharing options...
kahymo Posted January 3, 2021 Author Share Posted January 3, 2021 @benanamen if you can not find a solution to the problem, you can just pass have a nice day Hal Quote Link to comment https://forums.phpfreaks.com/topic/311962-redirect-domains-to-a-urldomains/#findComment-1583639 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.