I have a project with a php docker that I make work with this code:
docker-compose.yml
version: '3'
services:
www:
image: php:7.4.30-apache
volumes:
- "./:/var/www/html"
ports:
- 8000:80
build: .
Dockerfile
FROM php:7.4.30-apache
RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
RUN a2enmod rewrite
index.php
<?php
echo "hello world";
.htaccess
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)--([a-zA-Z0-9_-]+)$ title.php?title=$1&title_id=$2
RewriteRule ^profile/([a-zA-Z0-9_-]+)$ profile.php?username=$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.php [NC,L]
but when I go to the site, I get this:
enter image description here