I’m rewriting a url to a users profile with mod_rewrite like this: domain.com/users/JohnSmith.
I was thinking maybe it would be neater to skip the users folder and simply put it like: domain.com/JohnSmith.
My question: How do I do this and keep my system and site folders? If I look for domain.com/browsersupport, the profile.php page will check the name and look for it in a database, and since no user has that name, no page will be shown.
I know it can be fixed with some if statements in the PHP-code. Also, the folders name need to be reserved so users can’t register those names. But for the profile look up – is there a neater way? Maybe to exclude the system folders in the .htaccess file so profile.php won’t go look for that user?
That is where these 2 conditions come into play:
If you have both ‘dynamic’ pages, and dynamic users, the RewriteRule should end in a process that checks whether a page by that name exists, and only if it doesn’t, serve the user page.