I\'m trying to get a CakePHP application to work. For this, I\'ve set up a brand new Debian installation, updated the configuration and put everything in /var/www, which has
If allowed by your provider you may put all in the httpd.conf file as follow
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
</Directory>
And so on for others directories...
Removing .htaccess from main file may solve this problem. It worked for me(need not remove from webroot)
CakePHP has only one .htaccess
file inside webroot directory. No need more .htaccess
files. You must set app/webroot
as your DOCUMENT_ROOT
.
The answer is that there are 3 different .htaccess files:
/var/www/app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
/var/www/app/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/var/www/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
It's been my fault, everything is listed on the CakePHP site. Thanks to everyone!
The correct .htaccess is the default:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
You have to add this in "/etc/apache2/sites-enabled/default":
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
if section already exists change AllowOverride None to AllowOverride All