OddOneOut / bwp-minify

A WordPress Minification plugin that relies on Minify PHP library and WordPress's enqueueing system to serve minified CSS and JS to your audience
http://betterwp.net/wordpress-plugins/bwp-minify/
49 stars 23 forks source link

Multisite and 400 Bad Request #59

Open pixedelic opened 8 years ago

pixedelic commented 8 years ago

Hello, before switching to multisite I didn't have any problem with your great plugin, but after installing a multisite I always receive '400 Bad Request'. Any way to debug?

TIA, Manuel :-)

pixedelic commented 8 years ago

Doesn't matter, used the solution suggested by other people:

define('WP_CONTENT_URL', '/subdir/subsubdir/wp-content');

since this was the scenario. Still working on it, but it seems to fix the problem. Thank you!

pixedelic commented 8 years ago

Too soon, the workaround fixes the first group of combined scripts, but it compromise the second. Why this is the created url

http://www.domain.com/themes/my-theme/wp-content/plugins/bwp-minify/min/?f=themes/my-theme/wp-includes/css/jquery-ui-dialog.min.css,themes/wp-content/plugins/contact-form-7/includes/css/styles.css

when it should be

http://www.domain.com/themes/my-theme/wp-content/plugins/bwp-minify/min/?f=themes/my-theme/wp-includes/css/jquery-ui-dialog.min.css,themes/my-theme/wp-content/plugins/contact-form-7/includes/css/styles.css

(look at the presence of my-theme in the both the combined file in the second example but in one of file only in the first example)

What is the function that create the urls and how can I fix it locally at least?

pixedelic commented 8 years ago

Ok, found the function _get_blog_path() and this line:

$blog_path = preg_replace('#/[^/]+#ui', '', $blog_path, 1);

This creates the issue, it doesn't remove the necessary parts, I fixed it in this way, but I know it isn't very elegant and maybe it works with my scenario only, so please consider a different solution or, maybe a hook to define the base url from the option panel:

$blog_path = str_replace('/' . $this->base, '', $blog_path);

And since I finally found a solution to a very old problem of mine: https://open.spotify.com/track/2eoX63MjyeIBuopR6kxYPT

kminh commented 8 years ago

Hmm shouldn't WP_CONTENT_URL be a URL? You're using a path there.

Is there a specific reason why you're putting everything under themes/my-theme, or is that simply an example?

Anyway, I believe I have fixed this in a local 1.4 branch, but will mark this as a bug so I can later notify you.

Nice track, btw!

pixedelic commented 8 years ago

themes/my-theme means I'm using two subdirectories, just this. I sell WP themes, so my theme demos are in "www.domain.com/themes/theme-name". Do not consider the comment talking about WP_CONTENT_URL please, since that solution didn't work at all.