From faf20c0dc852e5e2f56734c14a30259e6444ee4d Mon Sep 17 00:00:00 2001 From: dohodin Date: Thu, 16 Mar 2023 13:26:19 +0100 Subject: [PATCH] Add .htaccess file, route now working --- Source/API/Dockerfile | 8 ++++++-- Source/API/script/.htaccess | 4 ++++ Source/API/script/index.php | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 Source/API/script/.htaccess diff --git a/Source/API/Dockerfile b/Source/API/Dockerfile index 1a6fa67..17512c3 100644 --- a/Source/API/Dockerfile +++ b/Source/API/Dockerfile @@ -1,6 +1,10 @@ -FROM shinsenter/slim:latest +FROM php:8.1-apache RUN apt-get update && apt-get install -y git RUN docker-php-ext-install pdo pdo_mysql COPY ./script /var/www/html WORKDIR /var/www/html/Config -RUN composer update && composer install \ No newline at end of file +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer +RUN composer update && composer install +RUN a2enmod rewrite +RUN a2enmod actions +RUN service apache2 restart \ No newline at end of file diff --git a/Source/API/script/.htaccess b/Source/API/script/.htaccess new file mode 100644 index 0000000..66ef8f6 --- /dev/null +++ b/Source/API/script/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^ index.php [QSA,L] diff --git a/Source/API/script/index.php b/Source/API/script/index.php index ad8d91e..d3a22d1 100644 --- a/Source/API/script/index.php +++ b/Source/API/script/index.php @@ -14,7 +14,7 @@ use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Slim\Factory\AppFactory; -require 'Config/vendor/autoload.php'; +require './Config/vendor/autoload.php'; /** * Instantiate App