- Make sure your server has mod_rewrite on! That one is easy to figure find a how to online if you are not sure.
- Then, make sure you have a .htaccess file you can modify or create
- Link a unique field to a user id in the Database so he can chose his site: EG: On google for example, it would look like www.google.com/neobahamut20
- In your .htaccess file, add the following:
# PROFILER
RewriteEngine On
RewriteRule ^([\w_-]+)$ profile.php?u=$1
# END PROFILER
- And it should work. Make sure however that you do not allow dots when the user chooses his name with this one as it will not be found instead of redirecting to a profile page.
- Don't ask why this need a ^ at the beginning when normally the regex wouldn't require one. (if you know, please comment!)
Web development blog mainly about my own use of PHP & JQuery addons and things not to forget (a quick reference) such as addons, and other pages of interest.
Monday, June 6, 2011
Profile link system site.com/username Apache
This one is fairly simple but took me a while to figure out due to lack of examples/how to on the web for this thing:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment