Url friendly by HTACCESS

0

I'm working on pure PHP and I want to work in ajax with friendly urls but I do not know how to configure the htaccess or where to locate it.

What have I tried?

create the .htaccess with RewriteRule ^utilities/(.+)\.php utilities/functions.php?function=$1

but I do not know where to locate it, since I have the following, www.dominio.iq/tv/views/administrator/home.iq - > vista www.dominio.iq/tv/js/administrator/functions.js - > ajax which contains the following code

 $.changePassword = function (){
    var parametros = {};
    $.ajax({
        data:  parametros,
        url:   '../../utilities/changePassword.php',
        //dataType: "json",
        success:  function (response) {
            console.log(response);
        }
    });

  }

www.dominio.iq/tv/utilities/functions.php - > controller which has a function

<?php
function changePassword(){
      //$oldPassword = $_GET['oldPassword'];
      //$newPassword = $_GET['newPassword'];
     //Y ya lo actualizaria en la bd
     echo "llego";
}
?>

so the idea is that when I do this url: '../../utilities/changePassword/parametros_1/parametro_2/...parametro_n', go to url: '../../utilities/functions.php to the call changePassword() and receive the parameters that I sent if necessary.

    
asked by Andrés Vélez 15.11.2018 в 17:44
source

1 answer

0

I hope my answer may be useful, first you should Evaluate where your web server is pointing, example:
if the domain www.tusitio.com is pointing to /var/www/tusitio.com is in that folder where you should have your file .htaccess
On the other hand you should see the content of your file to see if it has the configuration you require ..! in This Website There are many configuration examples that you can use ...!

    
answered by 15.11.2018 в 21:45