I own, say, 100 domains. I want to add redirect for each of them to a new domain. And not only to a domain, but a custom query string. For instance

domain1.example/url1 -> domain11.example/url2
domain2.example/url1/url4 -> domain15.example/fdsafds/url33/url555

# and so on......., 100 domains with 100+ URLs each

All the original URLs and the new ones are known beforehand. And there're hundreds of URLs for each domain.

Requirement: there has to be an intermediate "domain-redirector" via which the domains will be redirected, and that'll do all the job:

domain1.example/url1 -> my_redirector.example/url1 -> domain11.example/url2
domain2.example/url1/url4 -> my_redirector.example/url1/url4 -> domain15.example/fdsafds/url33/url555

# and so on.......

This way I'd create A record for each of the domains pointing to my_redirector.example. And at my_redirector.example I'd be able to extract a) original query string from the URL b) original domain

Note that it needs to work with both http and https.

Question 1: will original domain and URL or query path be accessible at my_redirector.example?

Question 2: will I have to create a SSL certificate for each of the original domains domain1-domain100 at my_redirector.example, in order to be able to redirect https requests?

P.S. I'm a developer, therefore I'm capable of writting a custom utility to facilitate redirects at my_redirector.example

  • Is your server using cpanel or directadmin or something similar? – Steve Sep 5 '20 at 6:10
  • @Steve that's irrelevant to the question – kosmosu05 Sep 5 '20 at 6:35
  • 3
    When you ask for help and a person who wants to help asks a question, a response like that isn't the best way to get yourself an answer :P – Steve Sep 5 '20 at 7:59
  • 2
    All questions here must use example domains of the form example.com or domain.example. Using .com domains as example that are otherwise valid isn't fair to those actual domain names or their competitors. Please don't revert edits that improve your post. – Stephen Ostermiller Sep 5 '20 at 9:48

It is impossible to redirect HTTPS without a certificate. You cannot redirect with via DNS alone. Even a CNAME record, which is a type of alias, is not a redirect. A CNAME simply says that all requests go to the same IP address as the specified domain name. It is up to the server how to handle those requests. It is the job of the web server to issue redirects. To be able to issue a redirect for a HTTPS URL, the web server needs a valid SSL certificate to have negotiated the encryption in order to be able to issue a redirect.

I now recommend hosting your alternate domains with CloudFlare to do redirects.

  • CloudFlare has domain redirect functionality.
  • CloudFlare uses custom "page rules" with wildcards to be able to customize the redirect path.
  • CloudFlare is a certificate authority and issues its own valid SSL certificates.
  • CloudFlare will redirect domains with HTTPS under its free tier of service. Because each domain you host with CloudFlare gets its own service tier, you can redirect unlimited domains using CloudFlare.

The biggest problem with CloudFlare is that setting up the redirects is an 8 step process. They are designed to be a CDN an their interface is geared towards that. Setting up redirects isn't as straightforwards as with other forwarding services. See the complete instructions here.

Using a custom query string on CloudFlare is possible. You need a "page rule" for each one. The basic redirect takes one page rule. The free tier has two other page rules available. If you need more rules to support your path changes, you would have to sign up for paid plans. Alternately, you could set up CloudFlare to redirect to a custom directory on your main site which then redirects to where you want it. Then you could use your main domain hosting for all the redirect rules you need.

domain1.example/url1 -> domain15.example/domain1/url1 -> domain15.example/fdsafds/url33/url555
  • I'm not asking how to redirect. Nor am I asking for a solution. Re-read my questions – kosmosu05 Sep 5 '20 at 9:41
  • 2
    I started by answering question 2. You have to create a certificate. Cloudflare is the intermediate domain-redirect that you are asking for. It creates the certifaces for you. It handles custom paths. I even show how the original domain and URL path are available to CloudFlare for you to work with. How does this not answer your question? I don't know of any free redirector service other than CloudFlare that handles HTTPS. – Stephen Ostermiller Sep 5 '20 at 9:45
  • Are you able to read? I think you're stuborn. You're still defending your answer. Re-read my question. I am not asking about any service that handles redirects - I don't need it. And I'm not asking about a service that generates ssl certificates - I don't need it either. – kosmosu05 Sep 5 '20 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.