Ubuntu 12.04 Apache 2 - Inline CSS working but external CSS not working

8,909

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.

Share:
8,909
Fried Brice
Author by

Fried Brice

Software Engineer at Mercury Technologies. Formerly Haskell and Purescript at Lumi. Formerly machine learning and GraphQL API servers in Scala at CJ Affiliate. Mathematician. I've done research in Lie algebras and Linear/Multilinear Algebra. I've worked on bayesian machine learning and distributed systems. I prefer languages that function. My favorite RPG is Gmail, and my favorite puzzle game is sudo pacman -Syu.

Updated on September 18, 2022

Comments

  • Fried Brice
    Fried Brice over 1 year

    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>