diff --git a/Dockerfile b/Dockerfile index 00da9a2..fa03975 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 - diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..3aec5e2 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,21 @@ + + + Options -MultiViews -Indexes + + + 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] + diff --git a/public/index.php b/public/index.php index 65bfbca..6430354 100644 --- a/public/index.php +++ b/public/index.php @@ -1,3 +1,3 @@