I have a project in a Compute Engine (GCP) instance which I develop in PHP, HTML, CSS, JS and MySQL persistence. The problem is the following:
When testing the project on a local server (XAMP) it works correctly but when migrating everything to the Google VM it loads the initial page in game.bochica.tk but then when you enter the data the following image appears:
After reviewing all the code I deduced that the problem is that I use a variable called Validate for the redirection in my index.php
Initially I have .htaccess where I give value to that variable:
Options All -Indexes
RewriteEngine on
RewriteRule ^([a-zA-Z0-9]*)$ index.php?validar=$1 [L]
and in my index.php I have this:
if (isset($_GET["validar"])) {
switch ($_GET["validar"]) {
case "inicio":
include "modules/inicio.php";
break;
case "salir":
include "modules/salir.php";
break;
case "ingresoSF":
include "modules/ingresoSF.php";
break;
default:
include "views/modules/inicio.php";
break;
}
}else{
include "modules/ingreso.php";
}
Does anyone know if .htaccess works on GCP instances?
In order for it to use per-directory configuration files ( ), the AllowOverride
.htaccess
directive must be configured in the Apache directory:.conf