I possess a project in PHP 7.3 that utilizes the YiiFramework 1.1. Previously, I was using it on Windows 10 with XAMPP, and it functioned as expected.
The issue I am facing is that after installing the necessary packages on Linux (apache2, php7.3 and its respective additional packages, mysql 8), it fails to recognize the requests and consistently returns a “404 Not Found” error.
I configured apache2 according to my understanding of the requirements:
- I set “AllowOverride All” for the directory /var/www/html/.
- I enabled the “rewrite” and “headers” mods for PHP, as my project requires them.
- I added my project to the folder “/var/www/html/”.
The project is named “cardapio10,” and I placed the code inside a “cardapio10/” folder within “/var/www/html/,” similar to how it was in Windows within “C://xampp/htdocs.”
The project has the following structure at its root:
- cardapio10/
---- app/
---- assets/
---- font/
---- protected/
---- yiiframework/
---- .git
---- .gitignore
---- .htaccess
---- .prettierrc
---- favicon.ico
---- index.php
The content of .htaccess is as follows:
<IfModule mod_rewrite.c>
RewriteEngine On
Header Set Access-Control-Allow-Origin "*"
RewriteBase /cardapio10
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cardapio10/index.php [L]
</IfModule>
My expectation is that upon accessing “http://localhost/admin/login,” the YiiFramework should interpret “/admin/login” and redirect me accordingly. However, this is not happening. Interestingly, I noticed that if I access it as “http://localhost/cardapio10/admin/login,” it finds the page.
I would like to know what configurations are necessary for me to access the URL without including “/cardapio10/” and achieve the same result.