Cake php configuration

2

I set up my cake all right, but when I open the main page, his css does not load, can anyone help me?

    
asked by anonymous 02.03.2015 / 02:20

1 answer

1

Error

is missing

How to configure

As you can see on cake php documentation the configuration of mod_rewrite is done as follows.

Apache and mod_rewrite (and .htaccess)

CakePHP is designed to work with mod_rewrite, but we realize that some users have been caught making this work on their systems, so we'll give you some tips you can try to make to run properly.

Here are some things you can try to do to run properly. First look at your httpd.conf (make sure you're editing the system httpd.conf instead of a specific user or site).

Make sure the .htaccess overlay is being allowed, that is, the AllowOverride is set to All for the DocumentRoot. You should see something similar to this:

# Cada diretório com o Apache tenha acesso pode ser configurado com
# relação aos quais serviços e recursos são permitidos e/ou
# desabilitados neste diretório (e seus subdiretórios).
#
# Primeiro, configuramos o o "padrão" para ter um conjunto muito
# restrito de recursos.
#
<Directory />
    Options FollowSymLinks
    AllowOverride All
#    Order deny,allow
#    Deny from all
</Directory>

Make sure you're loading mod_rewrite correctly. You should see something like:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

On many systems this is commented out by default (starting with a #), so you just need to remove those symbols.

After making the changes, restart Apache to make sure the settings are up to date.

Make sure your .htaccess files are in the correct directories.

This can happen during copying, because some operating systems treat files that start with '.' as hidden, so you will not be able to see them copied.

Make sure your copy of CakePHP comes from the download section of our website or from our GIT repository, and has been unzipped correctly by checking your .htaccess files.

In the root directory of Cake (needs to be copied to your DocumentRoot, it redirects everything to your application):

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

Your Cake app directory (will be copied to the main directory of your app by bake):

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

Cake's webroot directory (will be copied to the root of your web application by bake):

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

For many hosting services (GoDaddy, 1and1), your web server being served from a user directory that already uses mod_rewrite. If you are installing CakePHP into a user's directory ( link ), or any other URL structure that already uses the mod_rewrite, you will need to add RewriteBase statements to the CakePHP .htaccess files (/.htaccess, /app/.htaccess, /app/webroot/.htaccess).

This can be added to the same section of the RewriteEngine directive, for example, your webroot's .htaccess file would look like this:

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

The details of this change will depend on your configuration, and may include some additional things that are not related to Cake. See the Apache online documentation for more information.

    
02.03.2015 / 03:12