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:


<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
  SetHandler application/x-httpd-php
    <FilesMatch "\.phps$">
  SetHandler application/x-httpd-php-source
    <FilesMatch ".+\.html$">
        SetHandler application/x-httpd-php
    <FilesMatch ".+\.htm$">
        SetHandler application/x-httpd-php
    <FilesMatch ".+\.xhtml$">
        SetHandler application/x-httpd-php
    # 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


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

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.


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>
    <link rel="stylesheet" type="text/css" href="style.css" />

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

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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.