Ajout du mod rewrite pour prendre en compte toutes les requêtes.

This commit is contained in:
William 2022-07-01 14:41:50 +02:00
parent 4df4c1f023
commit 0724dcda24
3 changed files with 25 additions and 2 deletions

View File

@ -26,6 +26,9 @@ COPY vhost.conf /etc/apache2/sites-available/000-default.conf
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install pdo pdo_mysql mbstring exif pcntl bcmath gd zip curl intl
# Enable Apache mods
RUN a2enmod rewrite
# Clean cache
RUN apt-get -y autoremove \
&& apt-get clean \
@ -33,4 +36,3 @@ RUN apt-get -y autoremove \
# Copy source code
COPY . /var/www

21
public/.htaccess Normal file
View File

@ -0,0 +1,21 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

View File

@ -1,3 +1,3 @@
<?php
echo "Hello :)";
echo "Hello from " . $_SERVER['SERVER_ADDR'];