I have upload a complete cakephp project on ubuntu server here I used apache2.
My project worked properly in my locak server(xampp) but in server it showing this error:
The requested URL /users/login was not found on this server.
My project is located in var/www/html
.
This is my .htdocs
file:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
I need a proper solution.
Check that the apache configuration file has the rewrite_module line and that it's uncommented:
/etc/apache2/apache2.conf
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
Also make sure your override and symlink option are correct in the above apache configuration:
<Directory />
Options FollowSymLinks
AllowOverride All
# Order deny,allow
# Deny from all
</Directory>
Depending on your version of cakephp the .htaccess should like these.
app/.htacces CakePHP 2:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
/.htacces CakePHP 3:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
webroot/.htaccess Both versions:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>