05-28-2018, 03:26 PM
Hi all,
I have a main domain on a hosting company, my site.com, and 3 more different sites as addon domains to this domain. One of them is carsoncharge.com.
As I get warning 'parallelize downloads across hostnames' on pingdom, I searched the net for a solution and,
1) created a subdomain ( img.carsoncharge.com) for carsoncharge.com
2) copied the uploaded content to this subdomain.
3) added the code for the cookieless domain, to wp-config.php;
define("COOKIE_DOMAIN", "mydomain.com");
4) to enable parallel downloads, I added this code to 'functions.php' :
function parallelize_hostnames($url, $id) {
$hostname = par_get_hostname($url); //call supplemental function
$url = str_replace(parse_url(get_bloginfo('url'), PHP_URL_HOST), $hostname, $url);
return $url;
}
function par_get_hostname($name) {
$subdomains = array('img.mysubdomain.com'); //add your subdomains here, as many as you want.
$host = abs(crc32(basename($name)) % count($subdomains));
$hostname = $subdomains[$host];
return $hostname;
}
add_filter('wp_get_attachment_url', 'parallelize_hostnames', 10, 2);
5)I defined the upload path as 'https://img.carsoncharge.com/wp-content/uploads' from the panel https://carsoncharge.com/wp-admin/options.php
Problem is, nomatter what i do I, can't change the upload path, it keeps uploading to the original path. I tried plugins, wp-config.php snipped ( define UPLOAD. ...blah blah) I tried WordPress options.php. ..
And, after using parallelize downloads snipped I wrote above and upload path change together, uploaded image URL becomes this:
https://img.img.carsoncharge.com/wp-cont...8/05/a.jpg
It doubles the 'img' extension. I don't know why.
I contacted hosting company, they tried to solve the problem but couldn't achieve it.
I searched the net, almost 5 days but no result, all the posts have similar explanations.
I have a main domain on a hosting company, my site.com, and 3 more different sites as addon domains to this domain. One of them is carsoncharge.com.
As I get warning 'parallelize downloads across hostnames' on pingdom, I searched the net for a solution and,
1) created a subdomain ( img.carsoncharge.com) for carsoncharge.com
2) copied the uploaded content to this subdomain.
3) added the code for the cookieless domain, to wp-config.php;
define("COOKIE_DOMAIN", "mydomain.com");
4) to enable parallel downloads, I added this code to 'functions.php' :
function parallelize_hostnames($url, $id) {
$hostname = par_get_hostname($url); //call supplemental function
$url = str_replace(parse_url(get_bloginfo('url'), PHP_URL_HOST), $hostname, $url);
return $url;
}
function par_get_hostname($name) {
$subdomains = array('img.mysubdomain.com'); //add your subdomains here, as many as you want.
$host = abs(crc32(basename($name)) % count($subdomains));
$hostname = $subdomains[$host];
return $hostname;
}
add_filter('wp_get_attachment_url', 'parallelize_hostnames', 10, 2);
5)I defined the upload path as 'https://img.carsoncharge.com/wp-content/uploads' from the panel https://carsoncharge.com/wp-admin/options.php
Problem is, nomatter what i do I, can't change the upload path, it keeps uploading to the original path. I tried plugins, wp-config.php snipped ( define UPLOAD. ...blah blah) I tried WordPress options.php. ..
And, after using parallelize downloads snipped I wrote above and upload path change together, uploaded image URL becomes this:
https://img.img.carsoncharge.com/wp-cont...8/05/a.jpg
It doubles the 'img' extension. I don't know why.
I contacted hosting company, they tried to solve the problem but couldn't achieve it.
I searched the net, almost 5 days but no result, all the posts have similar explanations.