How to create user profiles with PHP and/or Rewrite engines
===

I have a database and table set up with a few fake registered users just for testing purposes.  I can log in with these profiles without any problem and even change the profile information on each one.

However I am unable to view these profiles without being logged into them. I want to have something like mywebsite.com/user/username

I looked it up extensively but I keep getting errors. I put this RewriteEngine in the .htaccess in the root directory.

    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.*)/$ index.php?user=$1

I created a users directory containing an index.php which has the following code:

    <?php
    
    $_GET['userid'];
    
    $url_request = $_SERVER['REQUEST_URI']; 
     $user_request = str_replace("/users/", "", $url_request); 
     $user_name = str_replace("/", "", $user_request); 
     
    ?>

When I test it out by going mywebsite.com/users/username, I get a 404 Not Found error. I know I'm missing something but I really do not know. If I can have some specific instructions on how to fix this problem, that would be great since I am still new and learning PHP.

	