Want more timely Centmin Mod News Updates?
Become a Member

Wordpress CSS / Formatting Broken after Wordpress migration

Discussion in 'Blogs & CMS usage' started by nqservices, Dec 16, 2018.

  1. nqservices

    nqservices Member

    68
    13
    8
    Jun 17, 2016
    Ratings:
    +27
    Local Time:
    9:16 AM
    1.11.1
    MariaDB 10
    Hi,

    I really need help on this. I have migrated a Wordpress website and all seems to be working properly, except for the frontend CSS / Formatting that shows broken when visiting the website.

    The way I migrated the website was:
    1- Create a new Wordpress site using Option 22
    2- Delete all the created files and uploaded my website files
    3- Create a new database and import the contents to it.

    The CSS / Formatting broken issue happens both viewing the website as a regular visitor and also as administrator.

    Below are errors that show on Chrome console panel. Can someone please help me and tell me what I need to do in order to resolve the issue?

    Thanks

    Refused to apply style from 'https://www.mydomain.com/wp-content/themes/mydomain/css/core/core.php?ver=4.9.9' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

    jquery-migrate.min.js?ver=1.4.1:2 JQMIGRATE: Migrate is installed, version 1.4.1

    (index):1 Error in event handler for (unknown): TypeError: Cannot read property 'length' of undefined

    at doBlacklistCheck (chrome-extension://pdknmigbbbhmllnmgdfalmedcmcefdfn/js/DomainBlacklist.js:54:34)
    at chrome-extension://pdknmigbbbhmllnmgdfalmedcmcefdfn/js/DomainBlacklist.js:23:24

    2(index):507 GET https://www.mydomain.com/wp-content/themes/mytheme/js/core/core.php?ver=4.9.9 net::ERR_ABORTED 403
     
  2. eva2000

    eva2000 Administrator Staff Member

    37,710
    8,254
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,710
    Local Time:
    7:16 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Centmin Mod values security and puts additional measures in place so that end users are also mindful of security. So in your case, you might need to whitelist or unblock the WP plugins related to your 403 permission denied messages.

    If you used centmin.sh menu option 22 auto installer Wordpress Nginx Auto Installer, the default wpsecure conf file at /usr/local/nginx/conf/wpincludes/${vhostname}/wpsecure_${vhostname}.conf where vhostname is your domain name, blocks php scripts from executing in wp-content for security

    Below links you can see examples of setting up specific wordpress location matches to punch a hole in the wpsecure blocking to whitelist specific php files that need to be able to run.

    If on Centmin Mod 123.09beta01, you may have ran into the new tools/autoprotect.sh cronjob feature outlined at Beta Branch - autoprotect.sh - apache .htaccess check & migration to nginx deny all | Centmin Mod Community You uploaded scripts may have .htaccess deny from all type files in their directories which may need bypassing autoprotect. It's a security feature that no other nginx based stack has as far as I know :)

    So instead, all .htaccess 'deny from all' detected directories now get auto generated Nginx equivalent location match and deny all setups except if you want to manually bypass the directory from auto protection via a .autoprotect-bypass file - details below here.

    You can read a few threads below on how autoprotect.sh may have caught some folks web apps falsely and the workarounds or improvements made to autoprotect.sh with the help of users feedback and troubleshooting.
    Check if your nginx vhost at either or both /usr/local/nginx/conf/conf.d/domain.com.conf and/or /usr/local/nginx/conf/conf.d/domain.com.ssl.conf has include file for autoprotect example
    Code (Text):
    include /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf;
    

    see if your directory for the script which has issues is caught in an autoprotect include entry in /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf which has a deny all entry
    Code (Text):
    cat /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf
    

    i.e.
    Code (Text):
    # /home/nginx/domains/domain.com/public/subdirectory/js
    location ~* ^/subdirectory/js/ { allow 127.0.0.1; deny all; }
    

    If caught you can whitelist it by autoprotect bypass .autoprotect-bypass file - details below here. So if problem js file is at domain.com/subdirectory/js/file.js then it is likely /subdirectory/js has a .htaccess with deny all in it - make sure that directory is meant to be publicly accessible by contacting author of script and if so, you can whitelist it and re-run autoprotect script to regenerate your /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf include file
    Code (Text):
    cd /home/nginx/domains/domain.com/public/subdirectory/js
    touch .autoprotect-bypass
    /usr/local/src/centminmod/tools/autoprotect.sh
    nprestart
    

    it maybe you need to also whitelist /subdirectory then it would be as follows creating bypass files at /home/nginx/domains/domain.com/public/subdirectory/.autoprotect-bypass and /home/nginx/domains/domain.com/public/subdirectory/js/.autoprotect-bypass
    Code (Text):
    cd /home/nginx/domains/domain.com/public/subdirectory/
    touch .autoprotect-bypass
    cd /home/nginx/domains/domain.com/public/subdirectory/js
    touch .autoprotect-bypass
    /usr/local/src/centminmod/tools/autoprotect.sh
    nprestart
    

    then double check to see if updated /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf include file now doesn't show an entry for /subdirectory/js
     
  3. nqservices

    nqservices Member

    68
    13
    8
    Jun 17, 2016
    Ratings:
    +27
    Local Time:
    9:16 AM
    1.11.1
    MariaDB 10
    @eva2000

    Thanks for the info. I will have to read that carefully.

    In the meantime I want to say that this website was hosted on a Apache server and the contents of the .htaccess are bellow. Can you please just check them to see if I need to do anything due to nginx?

    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    Also any way to disable the autoprotect temporary until I understand how to fix it?

    Thanks
     
  4. eva2000

    eva2000 Administrator Staff Member

    37,710
    8,254
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,710
    Local Time:
    7:16 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    nginx default try_files rule for wordpress via centmin.sh menu option 22 generated vhost takes are of permalinks equivalent for that .htaccess
     
  5. nqservices

    nqservices Member

    68
    13
    8
    Jun 17, 2016
    Ratings:
    +27
    Local Time:
    9:16 AM
    1.11.1
    MariaDB 10
    Trying to understnd the info you provided before regarding the autoprotect. Im not an experience user, so I'm not uderstanding exactly what do I need to do in my case.

    Can you please look again to the error codes on my first message and try to tell me in a more simple way what do I ha eto do?

    Thanks
     
  6. eva2000

    eva2000 Administrator Staff Member

    37,710
    8,254
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,710
    Local Time:
    7:16 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
..