External CSS file does not load in browser

So, first of all, I want a preface, saying that I am very new to programming, so forgive me if I do not follow so quickly.

Now I have a problem that really bothers me over the past few days, and I have searched everywhere for a solution.

I am using the WAMP server configuration. Everything worked fine until I started working with CSS. I have an external CSS file.

When I view my HTML page in Dreamweaver, I see that it connects correctly to this CSS file. I see how styles are applied in the Design view. However, when I view the page in a browser, Firefox says (in the Error Console) that the .css file cannot be loaded because its MIME type is text / html and not text / css.

So, I realized that this is a server configuration problem. I did the following: I went into the .HTACCESS file and added the following line: AddType / css.css text

After rebooting my server, this still did not solve the problem. For some reason, the browser continues to read my css file as an html file. Any idea what might be wrong here?

Here is the header of the file I'm trying to download in the browser (this is actually a Smarty template):

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../htdocs/css/styles.css" type="text/css" media="all" />
</head>

Also note that I am coding using the Zend framework. Here is my .HTACCESS file:

Rewriteengine on

RewriteCond% {SCRIPT_FILENAME}! -f

RewriteCond% {SCRIPT_FILENAME}! -d

RewriteRule ^ (. *) $ Index.php / $ 1

AddType text / css.css

So, I took DA advice and clicked on View Page Source while viewing the page in the browser and clicked on the link to my CSS file. Here is what he shows me:

When I click the link, I see the following:

<br />
<font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0'  cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in C:\shaancode\www\phpweb20\htdocs\Zend\Controller\Dispatcher\Standard.php on line <i>248</i></th></tr>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Zend_Controller_Dispatcher_Exception: Invalid controller specified (error) in C:\shaancode\www\phpweb20\htdocs\Zend\Controller\Dispatcher\Standard.php on line <i>248</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>

<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0006</td><td bgcolor='#eeeeec' align='right'>382488</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='C:\shaancode\www\phpweb20\htdocs\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0892</td><td bgcolor='#eeeeec' align='right'>4748936</td><td bgcolor='#eeeeec'>Zend_Controller_Front->dispatch(  )</td><td title='C:\shaancode\www\phpweb20\htdocs\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>42</td></tr>
</table></font>
+3
4
href="../htdocs/css/styles.css"

htdocs webroot. , , , -, ../ , . htdocs, 404.

- Zend " ()" ( " , ", 200 OK, " HTML-" " ".

../htdocs/ URL.

+1

, CSS, <link rel=stylesheet href="cssName.html"> Mozilla. , , .

0

. CSS , 404 ( ), , CSS.

, . WAMP, .

?

  • Firefox ( )
  • CSS, . , , .
  • CSS ?

, , . , ( -), .

EDIT: Zend Framework

, CSS ZF/public/css,

$this->headLink()->appendStylesheet('/css/styleForThisPage.css'); // in your view 

( )

echo $this->headLink()

, sitewide css, CSS ,

echo $this->headLink()->appendStylesheet('/css/global.css');
0

! , href. , , , , , !

Dreamweaver ! , , , !

So I installed the root site in Dreamweaver in my Root directory (where .HTACCESS is located) and changed the path to just "/css/styles.css".

And now it works!

Sorry to bother everyone and thank everyone for your help!

0
source

All Articles