Change wp-content dir to other host #70

Open
Lofesa opened this Issue Oct 28, 2016 · 8 comments

Projects

None yet

2 participants

@Lofesa
Lofesa commented Oct 28, 2016 edited

Hi
First of all, thx for your job.
Well, I tryed to change wp-content to other vhost.
I put
define('WP_CONTENT_DIR','new/path/wp-content');
define('WP_CONTENT_URL','https://vhost/wp-content'):
in wp-config.php, with and w/o set 'https://vhost' at cdn field in autoptimize config.
No file where created unless an empty /new/path/wp-content/cache/autoptimize/js/autoptimize_XXXX.js.
If these file is created, no file permision issue here. All css and js files from wp-include, theme and plugins are downloaded from https://vhost correctly. Seems the AO don´t cacht these files to do their work (unify and minify). No error in logs nor display.
Some clue to debug this?
Thx in advance

@Lofesa
Lofesa commented Oct 28, 2016

Hi again
After some digging, If the line 74 of the file autoptimizeBase.php is commented out, this work,but.... only with css and js files in /new/path/wp-content. Files in /old/path/wp-includes don´t

@futtta
Owner
futtta commented Nov 1, 2016

not a simple issue Lofesa; AO uses the wp-content URL and DIR to "translate" each URL to a FS path. looks what like you did breaks that. I might look into this one day, but afraid I don't have time now (or in the next couple of weeks).

frank

@Lofesa
Lofesa commented Nov 2, 2016

Hi @futtta
I tried to solve that.
Changes are in line 74 and between lines 82 -101 on the file I attach here.
Don´t know if this is the best approach but work.

autoptimizeBase.txt

@futtta
Owner
futtta commented Nov 11, 2016

Hi @Lofesa; could you upload the altered version of autoptimizeBase.php as a gist, or could you fork autoptimize and (if you're convinced this is the right solution) do a pull request?

@Lofesa
Lofesa commented Nov 14, 2016

Hi @futtta
Sure. Here is the gist of the altered file

https://gist.github.com/Lofesa/29dca53264547f90b9f4457584172546

I don´t be convinced this is the rigth solution because I get focused to solve my own issue (change wp-content dir and wp-content url at same time). I don´t tried to change only wp-content dir (modifiying the vhost for that creating a location in nginx) or creating an vhost with rootdoc to wp-content and play with the cdn field of autoptimize. I don´t know if the modifications I make works in this cases.
But I´m glad if this help someone or help to make a better plugin

@futtta
Owner
futtta commented Dec 18, 2016

OK, had a go at this, cfr. 1386e4f

Could you download the github zip-file and test (first on a non-productions site) if this works for you?

@Lofesa
Lofesa commented Dec 19, 2016

Sorry to be late.
I tried it but files are not created, In the html are referenced but get 404 error. I had no time now for digging in it, but as soon as possible I do.

@futtta
Owner
futtta commented Dec 19, 2016

OK, let me know, I'll be happy to fix once we know what is not working as expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment