CakePHP - 404 Page Not Found Error When Deploying to Another Machine

I am trying to deploy cakephp application to my peer system and I get 404 error for all requests. This is not a cakephp 404 error, but no error was found on the regular 404 server web page. :( We both use MAC OS 10.6. The same code works on my machine and on the production system. Steps for deployment on his machine. I use the advanced cakephp installation, i.e. webroot contains only index.php, css, js, etc. .d. The APP folder and CAKE folder are located somewhere else.

  • uncommented line "LoadModule php5_module ...." in / etc / apache 2 / httpd.conf
  • Changed for AllowOverride All for the directory - "Library / WebServer / Documents" in / etc / apache 2 / httpd.conf
  • uncommented and set date.timezone to /etc/php.ini
  • The contents of webroot were copied to "Library / WebServer / Documents" and index.php changed to adapt to its machine (setting 3 corresponding paths to the CORE, APP and CAKE folder).
  • make sure the database connection is good.
  • For the purpose of debugging, Modified core.php and set Configure :: write ('debug', 3);

The home page receives data from an AJAX call. WHen I goto http: // localhost , the contents of the header and footer from the /default.ctp layouts are rendered, but the ajax call, which is, for example, http: // localhost / posts / showmyposts gets a 404 error (not found). If I go to other URLs such as http: // localhost / users / login , I get a 404 normal web server error.

Not found

URL/users/login/ .

apache

[Mon May 16 16:19:48 2011] [error] [client:: 1] :/Library/WebServer/Documents/users, referer: http://localhost/ ​​ cakephp?

+3
5

, mod_rewrite . , Cake ? CSS ?

.htaccess ( -)?

FollowSymLinks Apache?

+6

.

, .htaccess public_html :

<IfModule mod_rewrite.c>
        RewriteEngine On
        #Rewrite CakePHP
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !server-status
        RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

.

+4

, (/posts/*) 404. .

, , posts.sql, . , . .sql Cake .

+1

httpd.conf( Linux - /etc/httpd/conf/httpd.conf) , CentOS.

In addition to <Directory /var/www>, as stated in the CakePHP docs, if you go a little further you will see <Directory "/var/www/html">that does not allow overwriting.

Change AllowOverride Noneto AllowOverride All.

Be sure to reset apache with sudo /sbin/service httpd restart.

0
source

If the above solutions have no effect, make sure apache rewrite module is enabled

In debian it is disabled by default

a2enmod rewrite
service apache2 restart
0
source

All Articles