Coly010 Posted August 18, 2014 Share Posted August 18, 2014 I was looking at Facebook and Twitter and noticed that when you view a user, in the address it bar it has say facebook.com/username My question is can I do a similar thing with PHP, instead of having /viewuser.php?id= I'm not exactly sure what to search for on google either, so if someone can give me a proper name for this then I can do a bit of digging Quote Link to comment Share on other sites More sharing options...
sniko Posted August 18, 2014 Share Posted August 18, 2014 You're looking for vanity URLs/pretty URLs - mod_rewrite. An example would be something like; RewriteEngine On RewriteRule ^([^/]*)$ /viewuser.php?u=$1 [L,QSA] However, that would direct everything to viewuser.php - but it's a start. To accomplish what you're trying to achieve, look at RewriteCond (rewrite conditions) Quote Link to comment Share on other sites More sharing options...
Coly010 Posted August 18, 2014 Author Share Posted August 18, 2014 (edited) Thanks sniko, I'll look into that :) Got it working now, thanks for the help :) Edited August 18, 2014 by Coly010 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.