0
I have a website running on a machine for several months. I need to deploy it on a new machine, so I am doing all the configuration, including the one of Apache2.
Since I am using Slim framework . I need to redirect all my requests to the index.php. For this I am using Apache2's mod_rewrite, but it doesn't work.
I tried to do everything like I did on the previous machine, but I might miss something.
Here is my .conf
file, /etc/apache2/sites-enabled/vigisolement-dev-slim.conf
:
<VirtualHost *:80>
ServerName msdi.dev.nfc-interactive.fr
DocumentRoot /var/www/vigisolement-dev-slim-RUNNING/public
<Directory /var/www/vigisolement-dev-slim/RUNNING/public>
AllowOverride All
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</IfModule>
</Directory>
# These lines redirect to an otherweb service, I don't think this to be linked
# with my problem (I have the same results if I comment them)
ProxyPreserveHost On
ProxyPass /japis http://127.0.0.1:8080/apis_vigisolement_java_dev/japis
ProxyPassReverse /japis http://127.0.0.1:8080/apis_vigisolement_java_dev/japis
ErrorLog /var/www/vigisolement-dev-slim-RUNNING/logs/apache2_error.log
CustomLog /var/www/vigisolement-dev-slim-RUNNING/logs/apache2_access.log combined
LogLevel info rewrite:trace8
</VirtualHost>
My website architecture looks like this :
/var/www/vigisolement-dev-slim-RUNNING/
|-- public/
| |-- index.php
| |-- images/
| | |-- example.jpg
| |-- (some uninteresting stuff, like javascripts and CSS)
|-- src/
|-- (all my sources, my Slim's code)
The behaviour I want :
- If I request for an existing file (like
public/images/example.jpg
) : deliver it. - If I request any other file : redirect the request to
public/index.php
so it can do all my Slim framemork stuff.
The behaviour I have :
- When I request for an existing file (like
public/images/example.jpg
) : it does deliver it. (Nice !) - When I request any other file : Error 404 (Not nice.)
I already did a sudo a2endmod rewrite
and a sudo service apache2 restart
.
Do you have any idea about what I could have miss ? Did I forgot to do something ?
Note that I am using Apache/2.4.29
on an Ubuntu 18.04.2
AWS machine.