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.