Hi David,
I suggest modifying the preg_match_all
regex and the str_ireplace
as shown below to achieve better results with replacements.
Eg. your original solution only replaces the first image url in an srcset
but mine replaces all image urls.
It is true that fixing the .jpg
extension in the pattern is not that great but the results are fine for me as I use jpg files in my posts. You can improve it if you like.
Here are the diffs of the two modifications for wp-content/plugins/domain-sharding/domain-sharding.php
:
@@ -334,7 +334,7 @@
{
if ( $buffer != '' )
{
- preg_match_all('/src\s*=\s*"([^"]+)"/sim', $buffer, $result, PREG_SET_ORDER);
+ preg_match_all('/(https?:\/\/[^"\']+?\.jpg)/sim', $buffer, $result, PREG_SET_ORDER);
$urls=array();
foreach( $result as $row )
and
@@ -394,7 +394,7 @@
$url = str_replace('https://', '//', $url);
}
- $buffer = str_ireplace( '"'.$original, '"'.$url, $buffer );
+ $buffer = str_ireplace( ''.$original, ''.$url, $buffer );
}
}
Additional feature of the modification that even wen an AJAX call is made, the image urls are replaced! ??
Cheers,
Immánuel
Hi,
There are problems using this plugin with php7 that should be fixed and I don’t know how to do it manually.
Thanks !
]]>Hi
I have installed the plugin and it speeds the site up massively however the following occurs:
1. IMages not SHowing
I can’t seem how to fix this
Any ideas
]]>I noticed that only specific folders are applied using this feature and some additional folders are not, I have few questions;
1. How can I add additional folders to the logic for the domain sharding functionality?
/wp-content/plugins/
/wp-includes/js/
/wp-content/uploads/
The folders above for some reason are not part of the sharding
2. When forcing HTTPs, how can I avoid the rewrite rule to rewrite back to www for HTTPs?
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Basically, I would like to have the following logic;
Rewrite HTTP to HTTPs
Keep the same sub-domain (will have multiple sub-domains)
Thank you!
]]>?Hola David!
I was hoping your Domain Sharding plugin might turn out to still be functional with versions higher than WP 4.1 – but alas, it does not seem so.
I set up sub-domains to working order (with custom DNS records and a wp-config.php entry as recommended), but the only effect the plugin still has is with regard to the 301 redirection.
It’s O.K., of course, though regrettable, if a plugin developer does not find justification for putting in the work needed to keep a certain plugin up-to-date. There may be any number of reasons for this.
Just wanted to let you know there is still interest in your Domain Sharding plugin, and if you were to update it, that would be much appreciated.
Gracias
]]>Hi,
When you are going to launch Latest Version.
Thanks
]]>Hi David.
1) Can I use my own subdomain? Not “cdn-#”. For example, I want to load images from subdomain “img”.
2) There is a tip in plugin admin:
“You can use the # character to mark the point where the domain random number will be inserted. Eg: https://img#.domain.tld”
So, is it necessary? I’ve got only one subdomain.
3) How to set up few subdomains? 2, 3, 4, 5?
Thank you.
]]>He instalado y configurado el plugin, en algunas páginas funciona correctamente y carga las imágenes como debe de ser, pero en algunas otras como en esta publicación: https://www.tncmx.com/el-arte-de-charles-burns/
sólo lo hace con la primer imagen.
También noté un error al realizar el test:
The file used to check the subdomain configuration is missing. Try reinstalling the plugin. Server Response Code: 404 Not Found
mis subdominios son img#
y también agregué include_once(ABSPATH.’wp-content/plugins/domain-sharding/domain-sharding-alias.php’);
?qué podrá ser?
La mayoría de mis imágenes están alojadas en otros hostings pero cada vez más las subo a WP es por eso que quise implementar la paralelización.
Saludos
]]>Hi,
thanks for developing this plugin. Today I did a few tests and realized, that the Domain Sharding is not as much optimized as it could be (much of the time it slows down the page).
E.g: I have the domain example.com and want to split the page elements on another domain, so I configured cnd-x.example.com and 1 in the settings.
Now something very bad happens: The first request goes to example.com and the second request, for the CSS-file, goes to cdn-1.example. On a performance point of few this is very bad because you need another dns lookup to get the CSS file, but the CSS file is blocking parallel downloads and also rendering blocking which defers the StartRender Time of the page.
A solution could be, that you split the requests equal on the main domain and on the other domain(s).
At the moment the plugin is not useful for me because the defered StartRendering Time is worse than not using more then 6 (Firefox) parallel downloads at once.
]]>Works great, but when debugging mode is enabled, it throws a few warnings. Code should be updated to be compliant with current WP standards.
]]>403 error when trying to detect the subdomains?
]]>Hi,
My dev domain is dev.mysite.com and my cdns are cdn0X.dev.mysite.com. But your plugin will generate only cdns like cdn0X.mysite.com.
I suggest that you modify the way we specify the domain. It would allow more flexibility if we could specify the domain like:
Domain: cdn0[cdn_number].dev.mysite.com
as it might help you identify it.
If you want access to my site to check it no problem.
]]>and i end up with cdns that don’t contain the domain name
]]>Works fine on single sites… but cant find the base url on a multisite?
A workaround?
]]>Hello friend
Thanks for the plugin
Really I no understand how works
Thanks for support