I dockerized my PHP (Yii 1.1 framework) & MySQL app successfully and First page of my website works fine on http://localhost:8000 but my problem is that when I want to go to another page of my website for example contact page (http://localhost:8000/contact) I face with this error:
Not Found The requested URL was not found on this server. Apache/2.4.54 (Debian) Server at localhost Port 8000
*Note that all of my websites page work fine on real host and even Wamp.
I have .htaccess file like this which works correctly on real host
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./index.php [L]
</IfModule>
And it’s my docker-compose file which I don’t think it has any thing related to this problem because as I said first page of website with all queries work perfectly:
version: '3.8'
services:
php-apache-environment:
container_name: php-apache
build:
context: ./sweetnfresh
dockerfile: Dockerfile
depends_on:
- db
volumes:
- ./sweetnfresh/src:/var/www/html/
ports:
- 8000:80
db:
container_name: db
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: MYSQL_ROOT_PASSWORD
MYSQL_DATABASE: MYSQL_DATABASE
MYSQL_USER: user
MYSQL_PASSWORD: pass
ports:
- "9906:3306"
volumes:
- ./dbdata:/var/lib/mysql
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- '8080:80'
restart: always
environment:
PMA_HOST: db
UPLOAD_LIMIT : 300M
depends_on:
- db