Re-direct example.com/user to example.com/user/profile.php

Whats the easiest way to Re-direct example.com/user to example.com/user/profile.php? I need a way that my server can set up on its own - that is, when a user registers with my site, it automatically sets up a redirection in this manner, so that someone may access the users profile simply by typing example.com/user and not have to add all that extra stuff. My site is based on PHP, but this is a .htaccess issue isn’t it? How can I write a PHP function to modify .htaccess and achieve this?

Thanks

Actually, the user would be fixed by the request but the use of profile.php SHOULD be as simple as making profile.php the first in line for the DirectoryIndex at the user directory level (it’s hierarchical so it’ll apply to every user you have).

Regards,

DK

not each user but, you’d use a regular expression for the user

.htaccess is just a plaintext file. You can create/read/write them as easily as any other file.

Thanks for the reply - so, would I just write .htaccess with the ReWrite rule for each user, and just have a massive .htaccess or is there a faster/less resource intensive way?