0

I'm trying to optimize a site and the last thing I want to do is to serve static content with a subdomain that will be without cookies, and I have a problem with that.

I tried a couple of things to do and I will describe what I did and what problems I had.

I first added the DNS record to hosting for the subdomain, set as A record and the content is set to server IP. Then added a subdomain in the control panel of the domain provider, set to the Authoban option used to serve static content at high speed. Then added a subdomain via cPanel and set Document Root to "public_html/wp-content/uploads" and added the following code to the top of the wp-config.php file:

define("WP_CONTENT_URL", "http://static.mysite.com");

After this, it was not possible to load the site and loading of WP admin panel was very slow and also it was not possible to load images inside the admin panel media tab.

The other thing I did was change the subdomain setting, on hosting and control panel of the domain provider, to the CNAME DNS record that points to main domain.

And after this change the loading of the site was very slow and only html was loaded, and there were errors about loading images and scripts from a static subdomain, in fact, it was not possible to access them.

Another important thing is that the site uses CloudFlare, but I do not currently have access data, I should soon have to get them.

So does anyone know where I'm wrong and how to do this right?

0

The Solution is in the Document root of your subdomain.

You must set it to "public_html/wp-content" because it also loads your themes' files which are outside the uploads directory

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.