В установленном apache2 для использования в качестве сервера разработки. Создал мой сайт, и он правильно загружается в моем браузере, за исключением того, что ...
Внешние таблицы стилей CSS не загружаются. Встроенный CSS работает, и тег style
работает, но link rel="stylesheet" type="text/css" href="style.css"
, похоже, ничего не делает.
Мой apache2.conf не редактируется. Вот мой файл php5.conf и мой файл conf сайта, если они нужны:
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-enable /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>
Я также столкнулся с той же проблемой, но я получил решение. Решение:
<link href="./css/stylesheet.css" rel="stylesheet" type="text/css" />
Примечание, что ".", прежде чем "/css" указывает на текущий рабочий каталог на Ubuntu. Я надеюсь, что это поможет Вам.
Я - derp. Я понял его. Оказывается, что это была определенная для страницы проблема, не проблема с сервером.
Вот код для моей страницы:
<!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>
И вот код для info.php
<?php phpinfo(); ?>
, Когда включать в мою страницу HTML комментируется, загрузки таблицы стилей как ожидалось. Быстрый взгляд на исходный код для info.php показывает
<style type="text/css">
body {background-color: #ffffff; color: #000000;}
Переопределение внешней таблицы стилей, но не любой информации о внутреннем или встроенном стиле
спасибо за рассмотрение моего вопроса.