wordpress的get方法中的自定义URL

I had add this form in homepage of my theme

<form action="" method="GET">
    <label>NAME:</label>
    <input type="text" name="name" id="name" required/>
    <button>GET</button>
</form>

<?php

 if (isset($_GET['name'])){

    $name = $_GET['name'];

  echo "hello".$name;}
?>

and here I am getting url at top is

example.com/?name=google

and i want custom url as

example.com/name/google

so what should i do to get custom URL by get method?

Change Permalink to postname wp automatically convert it

Go to Permalink settings in wordpress wp-admin. From there, select the option custom type or post type according to your requirements.