2

In installed apache2 for use as a development server. Created my site, and it loads correctly in my browser, except that...

External CSS stylesheets don't load. Inline CSS works, and the style tag works, but link rel="stylesheet" type="text/css" href="style.css" doesn't seem to do anything.

My apache2.conf is unedited. Here are my php5.conf file and my site conf file, in case they are needed:

mods-enabled/php5.conf

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
  SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
  SetHandler application/x-httpd-php-source
    </FilesMatch>
    <FilesMatch ".+\.html$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch ".+\.htm$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch ".+\.xhtml$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    <IfModule mod_userdir.c>
        <Directory /home/*/public_html>
            php_admin_value engine Off
        </Directory>
    </IfModule>
</IfModule>

sites-enables/au.camarillo.conf

NameVirtualHost au.camarillo
<VirtualHost au.camarillo>
ServerAdmin daniel@camarillo
#we want to be able to access the web site using www.au.camarillo or au.camarillo
ServerAlias www.au.camarillo
DocumentRoot /home/daniel/sites/au
#we want specific log file for this server
CustomLog /var/log/apache2/au.camarillo-access.log combined
</VirtualHost>

2 Answers 2

4

I also had faced the same problem but I got a solution. The solution is:

<link href="./css/stylesheet.css" rel="stylesheet" type="text/css" />

Note that the "." before "/css" is indicating the current working directory on Ubuntu. I hope this will help you.

0

I'm a derp. I figured it out. Turns out it was a page-specific problem, not a server problem.

Here's the code for my page:

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>

<div id="content">
...some content...
</div>

<div id="phpinfo">
<?php include('info.php') ?>
</div>

</body>
</html>

And here's the code for info.php

<?php phpinfo(); ?>

When the include in my HTML page is commented out, the stylesheet loads as expected. A quick glance at the source code for info.php reveals

<style type="text/css">
body {background-color: #ffffff; color: #000000;}

Overriding the external stylesheet, but not any internal or inline style info.

Thanks for looking at my question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .