Do .htaccess files work on Google Cloud VMs?

2

I have a project in an instance of Compute Engine (GCP) which develops it in PHP, HTML, CSS, JS and MySQL persistence. The problem is this:

When testing the project on a local server (XAMP) it works correctly but when you migrate everything to the Google VM it loads the initial page in game.bochica. tk but then when you enter the data I get the following image:

After reviewing the whole code I deduced that the problem is that I use a variable called Validate for the redirect 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 the .htaccess functions in the GCP instances?

    
asked by Jesús Henríquez 10.03.2018 в 17:22
source

1 answer

3

To use configuration files by directory ( .htaccess ), you must configure the directive AllowOverride in the Apache%% co:

<Directory "/var/www">
    # permite modificar (override) cualquier config en ese directorio y subdirectorios
    AllowOverride All
</Directory>
    
answered by 11.03.2018 / 01:21
source