Hi community,
I have a Yii 2 application up and running on a 20.04 Ubuntu server (PHP Version 7.4.3-4ubuntu2.19) and I’m trying to migrate this application to a Virtual Machine running a 22.04 (PHP Version 8.1.2-1ubuntu2.14). Both are using Apache2 as the webserver.
This application is running from /var/www/htdocs/pt3 and I transferred all content from the server to the exact same path on the virtual machine.
After doing this, in the virtual machine (destination), whatever link/tile I click I get an 404 error from Apache2.
Here is what I have on my Apache2 conf file and the .htaccess file that is sitting inside the /htdocs/pt3/ folder
Apache2 conf file
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port t>
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webadmin@localhost
DocumentRoot /var/www/htdocs
# Enable CGI
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
And .htaccess conf file
Options +FollowSymLinks
IndexIgnore /
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
<IfModule mod_suphp.c>
AddHandler application/x-httpd-php-5.4.13.php
</IfModule>
I have tried to disable pretty url in the Config/web.php from Yii and once I do this, I have a different 404 error when I click on the side menu.
If I try and click in the main tiles on screen I get the regular 404 error from Apache2
According to some people from the community, migrating a Yii application is as simple as copy and paste the main directory and pay attention to the webserver configuration. I’m not sure what I’m doing wrong.
Can someone help me, please?