I have a wordpress website which is using Cloudflare. So basically, I created a Cloudflare account and setup everything including changing the nameservers so that the domain goes through Cloudflare first.

Let’s say my domain is domain.com.

Now I have a sub-domain called temp.domain.com in which I need to parallelize downloads across hostnames.

All the necessary wordpress code (shown below) is already in place in functions.php.

function parallelize_hostnames($url, $id) {
     $hostname = par_get_hostname($url);
     $url =  str_replace(parse_url(get_bloginfo('url'), PHP_URL_HOST), $hostname, $url);
     return $url;
}

function par_get_hostname($name) {
    $subdomains = array('temp1.domain.com','temp2.domain.com', 'temp3.domain.com);
    $host = abs(crc32(basename($name)) % count($subdomains));
    $hostname = $subdomains[$host];
    return $hostname;
}

add_filter('wp_get_attachment_url', 'parallelize_hostnames', 10, 2);

So after following a tutorial, I set 3 A records in Cloudflare called temp1.domain.com, temp2.domain.com and temp3.domain.com to point to my server’s IP address.

Then in my CPanel I set 3 CNAME records with the same 3 names all pointing to temp.domain.com

Waited more than a day and now when I visit temp1.domain.com, temp2.domain.com or temp3.domain.com, I always get a hostgator 404 page.

What am I doing wrong please? Does this setup make sense?

The wordpress code is working since I could verify this in the browser console. However, all media requests via temp1, temp2 and temp3 are giving a NOT FOUND error.

Read more here: Cloudflare – CPanel – Parallelize downloads across hostnames


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: