I'm trying to install an application based on the slim micro-framework on my local server (LAMP) but there is a redirection problem in the configuration. The project architecture is as followed :
project
-/admin
-/app
-/config
-config.php
-/public
-/vendor
-/composer.json
-/composer.phar
-/public
-/assets
-index.php
-.htaccess(3)
-.htaccess(2)
-/css
-.htaccess(1)
The content of my .htaccess is :
.htaccess(1)
# Allow any files or directories that exist to be displayed directly
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (.*) localhost/project/$1 [R=301,L]
RewriteRule ^$ admin [L]
</IfModule>
.htaccess(2)
# Allow any files or directories that exist to be displayed directly
RewriteCond ${REQUEST_URI} ^.+$
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|js|css|swf|php)$ [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
# RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]
<IfModule mod_rewrite.c>
IndexIgnore *.zip *.jpg *.gif
RewriteEngine on
RewriteBase /admin/
RewriteRule ^$ public/index.php [L]
RewriteRule (.*) public/index.php?/$1 [L]
</IfModule>
php_value upload_max_filesize 1000M
php_value post_max_size 2000M
php_value memory_limit 3000M
php_value max_execution_time 180
php_value max_input_time 180
.htaccess(3)
<IfModule mod_rewrite.c>
Options -MultiViews
IndexIgnore *.zip *.jpg *.gif
RewriteEngine On
RewriteBase /admin/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
The config.php is used by the app for all env variables. The file is configured as following :
<?php
/* Server info */
define('MODE', "development");
define('APP_NAME', 'appname');
define('SERVER_URL', 'localhost/');
define('BASE_URL', SERVER_URL . 'project/admin/');
define('UPLOAD_URL', SERVER_URL . 'upload/');
define('BASE_FOLDER', '/var/www/html/project/admin/');
define('SERVER_FOLDER', '/var/www/html/project/');
define('APP_FOLDER', BASE_FOLDER . "app/");
define('TMP_FOLDER', BASE_FOLDER . "tmp/");
define('LOGS_FOLDER', BASE_FOLDER . "logs/");
define('UPLOAD_FOLDER', SERVER_FOLDER . "upload/");
define('FOLDER_NAME', "admin");
date_default_timezone_set('UTC');
/* Require */
require_once '../vendor/autoload.php';
When I try to access localhost/project/
I'm redirected to localhost/project/admin
which is fine but I get an 404 not found
.
When I try to access directly localhost/project/admin/public/index.php
, I have the menu displayed and still the 404 not found
error as in the following image :
I think I have severals issues in this configuration :
1 - to get the localhost/admin/public/index.php page requesting localhost/admin/
2- To have the localhost/admin/public/index.php working fine with no 404
It is working fine on the production server, but I can't get the app working on my local server. I modified the .htaccess files and the configuration files When I run the app on my server, I have NO error in my /var/log/apache2/error.log I don't understand the issue with my configuration, any help ?