I need to create a vanity URL redirect using htaccess and PHP.
My requirements are:
If a user writes example.com/users/foobar
The client will be redirected to for example:
profile.php?user=foobar
in either the /users/ directory or the root directory. Possibly in an /inc/ folder in the root directory.
A example.com
to www.example.com
redirect is also necessary.
The URL needs to stay same visually. I would like all of this in a single .htaccess file.
Optional:
I would also like (although not a requirement) the redirect to also be applied on example.com/foobar
I have not found any answers that does this.
/users/username/
intoprofile.php?user=username
the first example looks better and will help your committed members remember their URL easier, just saying...