Website's display messed up after enabling plugin (No CSS Formatting)

This happens because for some reason, the browser cannot access the contents of the combined file. Follow the following procedure to resolve this issue.

  1. Check the link to the combined file

    Inspect the source of the page to find the JCH Optimize generated link.

    Click on the link or copy and paste it in address bar of your browser. If the plugin is working properly, you should see the contents of the combined file displayed in the browser. In this case there's probably an error message.

  2. Determine the type of error to fix

    The error message will indicate what is wrong and how to fix it so performs the following steps based on the type of error observed.

    • File not found (Possible caching issue)

      If you see a File not found error message then the issue has to do with caching. The plugin caches the combined files so this error means that the cached file is not found. Ensure the plugin is ordered properly (if you're on Joomla!) and clear all your cache. Turn off all cache plugins while configuring the plugin.

      If you're on Joomla there's a plugin Content - Facebook-Twitter-Google+1 that deletes all your cache including the JCH Optimize cache required for the plugin to work. You can't use this plugin if you're using JCH Optimize. If you're interested in speeding up your site you shouldn't be using this plugin anyway as caching is the easiest way to reduce server response time.

    • 404 error (Check url rewriting)

      If you see a 404 error code then the problem is most likely due to url rewriting. The plugin uses url rewriting to generate the link to the combined file but perhaps this is not enabled on your server or is not working as expected. Disable the Use url rewriting setting in Advanced Options

      If you're on an NGINX server then you need to add the url-rewrite rule to the server's configuration:

                                  rewrite ^(.*?)/media/plg_jchoptimize/assets.*?/(gz|nz)/([^/]+)/([^/]+)/([^/]+)\.(js|css)$ $1/media/plg_jchoptimize/assets/jscss.php?f=$5&type=$6&gz=$2&d=$3&i=$4;
    • 500 Error (Fix file permissions)

      A 500 error code indicates possible incorrect file permissions or some type of restricted access. Via FTP or your cpanel File Manager, check the permissions of your /media/plg_jchoptimize/assets/jscss.php and /media/plg_jchoptimize/assets2/jscss.php files. These should normally be 644 but check with your host to be sure as your server could be configured differently. Also check the permissions of all the folders in that url to ensure they are correct. Folder permissions are usually 755. You can compare them to the permissions of your other files and folders on your server that are working to verify that you are using the correct permissions, or as mentioned above, check with your host.

      [Tip]Tip

      Check to ensure that there are no server configurations that are restricting access to php files at the locations listed above.

      In some cases this error could also be related to url rewriting so refer to the step above re the 404 error.

Top