I have a small personal project I’m working on, and before I get too deep into it, I’d like to get some opinions here on the best practices regarding the set up and URL scheme… and how I might set up the .htaccess rewrites for the following. My questions are:
-
Is the below set up the best way to manage user information in a small user profile setup?
-
I have worked out how to get the subdomain working for the rewrite username.domain.com with wildcard subdomains and
httpd.conffile set up… but I am stuck on the rest of the scheme seen below. Basically, a user profile will always result inusername.domain.comand then appended with the various pages within their account (photos, videos, notes etc). How would I set up the.htaccessrewrites to accommodate this? I really appreciate any advice here. I have done a ton of research here on stackoverflow, and on other sites, but I can’t find a decent explanation to achieve this.
Thanks for any help.
www.domain.com/profile.php?u=username –> username.domain.com
www.domain.com/photos.php?u=username –> username.domain.com/photos
www.domain.com/photos.php?u=username&a=album –> username.domain.com/photos/album
www.domain.com/photos.php?u=username&a=album1&p=photoid –> username.domain.com/photos/album1/photoid
www.domain.com/settings.php?u=username –> username.domain.com/settings
etc
Your proposed setup looks fine to me. Here are some rules for .htaccess (make sure you have mod_rewrite enabled and AllowOverride All set in your httpd.conf):