Use GET when url is hidden with .htcacess

0

I am using MVC php (I'm new to MVC) and I have a .htaccess file in which I have the following code

RewriteRule ^(\w+)$ index.php?action=$1

I have a driver

class Enlaces{

    public function enlacesController(){

        if(isset($_GET["action"])){

            $enlaces = $_GET["action"];
        }else{

            $enlaces = "index";
        }

        $respuesta = EnlacesModels::enlacesModel($enlaces);
        include $respuesta;
    }
}

and a model

class EnlacesModels{

    public function enlacesModel($enlaces){

        switch ($enlaces) { 
            case 'captura':             
                $module = "vistas/modulos/padron/".$enlaces.".php";
                return $module;
                break;
            case 'inicio':
            case 'ingreso':
                $module = "vistas/modulos/".$enlaces.".php";        
                return $module;
                break;  
            case 'index':
                $module = "vistas/modulos/ingreso.php";     
                return $module;
                break;                                                                      
            default:
                $module = "vistas/modulos/ingreso.php";
                return $module;
                break;
        }
    }
    }

and I have a form where I want to use a GET, but for the previous thing it does not allow it to me since the route hides the action (that it uses in the controllers with a previous get) and Meda the following route (it puts another "? "instead of" & ")

link

How can I solve that ????? Help !!!

this is the code of the form

  <div class="row">
      <form method="GET">
      <div class="form-group"> 
        <div class="col-sm-3 col-md-3 col-xs-12">           
          <label for="search_apat"> A Paterno: </label>
          <input id="search_apat" name="search_apat" class="form-control search_apat" type="search"></input>
        </div>
        <div class="col-sm-3 col-md-3 col-xs-12">
          <label for="search_amat"> A Materno: </label>
          <input id="search_amat" name="search_amat" class="form-control search_amat" type="search"></input>
        </div>
        <div class="col-sm-3 col-md-3 col-xs-10">
          <label for="search_ife"> Clave Elector: </label>
          <input id="search_ife" name="search_ife" class="form-control search_ife" type="search"></input>
        </div>
        <div class="col-sm-3 col-md-3 col-xs-2">
          <span class="input-group-btn">
            <a href="#">
              <button class="btn btn-primary" type="submit">                
                <i class="glyphicon glyphicon-search"></i>
              </button>
            </a>
          </span>                                  
        </div>   
      </div>  
      </form>                  
  </div>
    
asked by Rafa Arce 27.10.2017 в 00:59
source

1 answer

0

add the following rules to the .htaccess

   RewriteCond %{THE_REQUEST} ^GET\ /(.+)\.php(?:\?|\s) [NC]
   RewriteCond %{REQUEST_FILENAME} -f
   RewriteRule ^ %1/? [L,R=301] 
    
answered by 27.10.2017 в 04:15