I have an old WP that I recently converted to http/2, and the speed improvements were beautiful, to say the least.
However, there are several assets that are spread across several hostnames (all pointing to the same server root) because in the past dividing resources across hostnames was a boosting technique we were used to.
E.g.:
css.example.com
js.example.com
img.example.com
All of the above hostnames have their root exactly on /var/www/example.com/htdocs/
.
Even worse, some assets are referenced by https://example.com
and others by https://www.example.com
.
Now I want Nginx to replace all these hostnames to the normalized form https://www.example.com
, but there is no way to achieve this simple goal.
I read about subs_filter
here: EasyEngine 3.3 released with Full-Page Redis Cache support. I then tried to add this to /var/www/example.com/conf/nginx/nginx.conf
:
subs_filter https://example.com/ https://www.example.com/;
subs_filter https://css.example.com/ https://www.example.com/;
But no way to achieve my text replacement.
I’m using Nginx 1.9.10 (I run an ee stack upgrade --all
prior to trying this test).
Finally, I’d like to use the subs_filter
to force some stubborn customers to make use of my CDN to serve their huge image files. Currently the only way to tho this is using WP Super Cache support for CDNs, but I want something they can’t break.
Thanks!