Beginner in .htaccess (relatively simple case)

1

I have searched through various sources for a way to properly apply a simple htaccess rule for friendly url interpretation.

At first I have the following codes:

.htaccess

RewriteEngine on
RewriteCond %(SCRIPT_FILENAME) !-f
RewriteCond %(SCRIPT_FILENAME) !-d
RewriteRule ^([^/]*)$ index.php?url=$1
RewriteRule ^([^/]*)/$ index.php?url=$1

index.php

<!DOCTYPE html>
<html>
    <head>
        <title>Home</title>
        <meta charset="utf-8">
    </head>
    <body>
        <h1>Home</h1>
        <?php 
            $url = (isset($_GET['url'])) ? $_GET['url'] : '';
            echo $url;
         ?>
    </body>
</html>

Here are the results I got:

I hoped that the first one did not present any text below 'Home', and in the second the word 'test' should be presented instead of 'index.php'.

Can anyone tell me what I'm doing wrong?

    
asked by anonymous 20.07.2017 / 04:27

0 answers