且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CSS不能与CakePHP应用程序一起使用

更新时间:2023-10-17 13:16:58

我设法解决了。问题是我设置虚拟主机的方式,我的httpd-vhosts.conf文件现在看起来像这样:

 &lt ; VirtualHost *:80> 
ServerAdmin webmaster@invoice.dev
DocumentRoot/ Users / stephenxconnolly / Documents / Websites / invoice-new
ServerName invoice.dev
< Directory / User / stephenxconnolly /文件/网站/ invoice-new />
AllowOverride All
< / Directory>
#ServerAlias www.dummy-host.example.com
ErrorLog/private/var/log/apache2/invoice.dev-error_log
CustomLog/ private / var / log / apache2 /invoice.dev-access_logcommon
< / VirtualHost>

这解决了问题。


I'm having a problem with CakePHP, the CSS is not found. When I view the source code in my browser I can see the cake generic CSS link in the head section. But when I click on it to see the actual source code, I get a 404 not found error.

Update: I've followed the instructions here:

http://book.cakephp.org/2.0/en/installation/url-rewriting.html

to make sure the mod_rewrite is setup correctly but I'm still having trouble viewing the CSS file.

Update: THis is what .htaccess looks like in my root folder:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

This is what .htaccess looks like in my app folder:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

and this is what it looks like in my webroot folder:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

Regards, Stephen

I managed to solve it. The problem was with the way I set up my virtual host, my httpd-vhosts.conf file now looks like this:

<VirtualHost *:80>
    ServerAdmin webmaster@invoice.dev
    DocumentRoot "/Users/stephenxconnolly/Documents/Websites/invoice-new"
    ServerName invoice.dev
    <Directory "/Users/stephenxconnolly/Documents/Websites/invoice-new/">
         AllowOverride All
    </Directory>
#   ServerAlias www.dummy-host.example.com
    ErrorLog "/private/var/log/apache2/invoice.dev-error_log"
    CustomLog "/private/var/log/apache2/invoice.dev-access_log" common
</VirtualHost>

This solved the problem.