Cake php configuration

Asked

Viewed 348 times

2

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

inserir a descrição da imagem aqui

1 answer

1

Error

Missing configure the mod_rewrite from your apache server

How to set up

As can be seen in cake php documentation the configuration of mod_rewrite is done as follows.

Apache and mod_rewrite (e . htaccess)

Cakephp is designed to work with mod_rewrite, but we’ve noticed that some users have picked it up to make it work on their systems, so we’ll give you some tips that you can try to do to run properly.

Here are some things you can try to do to run properly. First check your httpd.conf (make sure you are editing httpd.conf from the system and not from a specific user or website).

Make sure that the . htaccess overlay is allowed, meaning that Allowoverride is set to All for 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 are loading mod_rewrite correctly. You should see something like:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

In many systems this comes commented by default (starting with a #), so you just need to remove these symbols.

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

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

This can happen during copying, as some operating systems treat files that start with >.' as hidden and therefore you will not be able to see them copy.

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

In the Cake root directory (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 application by Bake):

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

Cake 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 is served from a user directory that already uses mod_rewrite. If you’re installing Cakephp within a user directory (http://example.com/~username/cakephp/), or any other URL structure that already uses mod_rewrite, you will need to add Rewritebase instructions to the files. Cakephp htaccess (/. 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 be something like:

<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 setup, and may include some additional things that are not related to Cake. See the Apache online documentation for more information.

  • Exactly, missed setting up the webroot ". htaccess", thanks friend.

  • if you can mark as correct I appreciate

Browser other questions tagged

You are not signed in. Login or sign up in order to post.