• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Site preview not applying CSS

J

jrl0726

Guest
Hello,

I have a strange problem with the site preview feature in Plesk 7.5.3. For some reason it is not applying my CSS. My CSS are linked using a relative path and the site renders fine aside from not applying the CSS. If I browse to the site normally (after editing the hosts file on my computer), my browser shows the site with CSS applied. I created a simple test file:

<html>
<head>
<title>Test</title>
<link href="test.css" rel="stylesheet" type="text/css">
</head>

<body>
Test
</body>
</html>

Test.css contains the following:

body{
font-family: Arial,sans-serif;
font-size: 16px;
color: #333333;
line-height: 1.466;
margin: 0px;
padding: 0px;
background-color: #FFFFFF;
}

As before, the CSS works if I browse to the test file normally, but not in the site preview.

Have any of you encountered this problem?

Would any of you offer some suggestions as to what might cause this problem or how to go about troubleshooting it?

Thanks!
 
Try putting the full URL for your CSS file in the header. That should do it. If you check the address bar during the preview you'll see why a relative path doesn't work.
 
Thanks for your response, but I am a bit puzzled. The Plesk admin guide actually says that site preview *won't* work with an absolute path:

"Site preview does not work for the web sites and web pages that include absolute paths to other files (like <a href=http://domain.tld/image.gif> or <a href=/image.gif>)."

If I'm missing something obvious, please feel free to let me know.
 
It doesn't matter if you put a full-path, partial-path, or no path to the CSS file. It does not change the result.

It actually looks like the sitepreview.php is not processing the <link > .

When requesting the Sitepreview URL, log shows:
"GET / HTTP/1.1" 200 171 "-" "-"

When requesting the normal URL, log shows:
"GET /test.css HTTP/1.1" 304 - "http://www.testexpire.com/" "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4"

So it looks like it is a limitation in the sitepreview.php file.

This is why I usually do not use the sitepreview function.
 
That's interesting. I show this in the log when I access the site using site preview:

192.168.111.111 - - [07/Aug/2005:07:53:02 -0500] "GET /?previous_page=dom_ctrl HTTP/1.1" 200 16224 "-" "-"
192.168.111.111 - - [07/Aug/2005:07:53:02 -0500] "GET /css/test.css HTTP/1.1" 200 6493 "-" "-"

And this when I view the site normally:

99.0.99.1 - - [07/Aug/2005:07:51:13 -0500] "GET / HTTP/1.1" 200 16224 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4"
99.0.99.1 - - [07/Aug/2005:07:51:13 -0500] "GET /css/test.css HTTP/1.1" 304 - "http://domainname.com/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4"

So, the log shows retrieval of the CSS either way. I wonder if the problem has something to do with the fact that the Plesk server is behind a NAT, although I have no idea how the NAT could cause this issue.

Thanks for the reply.
 
Back
Top