1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Site preview not applying CSS

Discussion in 'Plesk for Linux - 8.x and Older' started by jrl0726, Aug 7, 2005.

  1. jrl0726

    jrl0726 Guest

    0
     
    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!
     
  2. phoenixisp

    phoenixisp Silver Pleskian

    27
    57%
    Joined:
    Feb 2, 2002
    Messages:
    840
    Likes Received:
    0
    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.
     
  3. jrl0726

    jrl0726 Guest

    0
     
    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.
     
  4. jamesyeeoc

    jamesyeeoc Guest

    0
     
    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.
     
  5. jrl0726

    jrl0726 Guest

    0
     
    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.
     
Loading...