• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Broken JS / CSS Responses by user

Jonatan Grim

New Pleskian
Hello Plesk Forum,

I'm using Plesk 12.5 on CentOS 6.7 with mod_pagespeed (Apache) (Server is up-to-date)
Extensions:
- Let's Encrypt

I have a problem with WordPress Admin.
Frontend CSS / JS is working perfectly.

When accessing /wp-admin, neither CSS or JS is working.

Results of JS:
nHPhj.png


If I try to remove a single parameter from the URL (removing &ver - as example):
3QZin.png


If a new user is accessing /wp-admin, no problems at all
It happens after time.

Can anyone help with this issue?
 
Hi Jonatan Grim,

pls. note, that this forum is a PLESK - related - forum. If you desire help with your Content Management System ( CMS, i.e.: wordpress, joomla, drupal, ... ) at your webspace, pls. consider to open a thread at:

=> Home > Forum > General Discussion > Open Topics

I'm aware that this forum is for Plesk and the reason I'm posting here, is because I was convinced this would be a server problem and not a WordPress problem.
 
Code:
<?php

/**
 * Disable error reporting
 *
 * Set this to error_reporting( -1 ) for debugging
 */
error_reporting(0);

/** Set ABSPATH for execution */
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' );
}

define( 'WPINC', 'wp-includes' );

require( ABSPATH . 'wp-admin/includes/noop.php' );
require( ABSPATH . WPINC . '/script-loader.php' );
require( ABSPATH . WPINC . '/version.php' );

$load = $_GET['load'];
if ( is_array( $load ) ) {
    $load = implode( '', $load );
}
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
$load = array_unique( explode( ',', $load ) );

if ( empty($load) )
    exit;

$compress = ( isset($_GET['c']) && $_GET['c'] );
$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
$rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] );
$expires_offset = 31536000; // 1 year
$out = '';

$wp_styles = new WP_Styles();
wp_default_styles($wp_styles);

/*
if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
    $protocol = $_SERVER['SERVER_PROTOCOL'];
    if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
        $protocol = 'HTTP/1.0';
    }
    header( "$protocol 304 Not Modified" );
    exit();
}
*/

foreach ( $load as $handle ) {
    if ( !array_key_exists($handle, $wp_styles->registered) )
        continue;

    $style = $wp_styles->registered[$handle];

    if ( empty( $style->src ) ) {
        continue;
    }

    $path = ABSPATH . $style->src;

    if ( $rtl && ! empty( $style->extra['rtl'] ) ) {
        // All default styles have fully independent RTL files.
        $path = str_replace( '.min.css', '-rtl.min.css', $path );
    }

    $content = get_file( $path ) . "\n";

    if ( strpos( $style->src, '/' . WPINC . '/css/' ) === 0 ) {
        $content = str_replace( '../images/', '../' . WPINC . '/images/', $content );
        $content = str_replace( '../js/tinymce/', '../' . WPINC . '/js/tinymce/', $content );
        $content = str_replace( '../fonts/', '../' . WPINC . '/fonts/', $content );
        $out .= $content;
    } else {
        $out .= str_replace( '../images/', 'images/', $content );
    }
}


// header("Etag: $wp_version");
header('Content-Type: text/css; charset=UTF-8');
// header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
// header("Cache-Control: public, max-age=$expires_offset");

/*
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
    header('Vary: Accept-Encoding'); // Handle proxies
    if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
        header('Content-Encoding: deflate');
        $out = gzdeflate( $out, 3 );
    } elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
        header('Content-Encoding: gzip');
        $out = gzencode( $out, 3 );
    }
} */

echo $out;
exit;

I have "solved" the problem by commenting much of the above code in load-styles.php
Since this works I'm positive that this is a server problem - a Plesk problem.

Anyone having any ideas?
 
Back
Top