ohdang888 Posted October 26, 2008 Share Posted October 26, 2008 Let's say there is a user name of "Bobby" and his user id was "12345" so most of my page urls are like this... http://www.mydomain.com/user/profile.php?id=12345 but how do i create something like this: http://www.mydomain.com/user/Bobby Like, where it goes to the folder "user", but then doesn't look for the file/folder named "bobby" I've heard a mod-rewrite does this, but how do i do that? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/130192-mod-rewrite-for-url/ Share on other sites More sharing options...
corbin Posted October 26, 2008 Share Posted October 26, 2008 RewriteEngine On RewriteRule ^user/([^/]+) /user/profile.php?name=$1 Then, in profile.php you would have to convert the name to id or what ever. Quote Link to comment https://forums.phpfreaks.com/topic/130192-mod-rewrite-for-url/#findComment-675193 Share on other sites More sharing options...
ohdang888 Posted October 26, 2008 Author Share Posted October 26, 2008 thanks... where do i put that code? Quote Link to comment https://forums.phpfreaks.com/topic/130192-mod-rewrite-for-url/#findComment-675233 Share on other sites More sharing options...
trq Posted October 26, 2008 Share Posted October 26, 2008 In your .htaccess file. Quote Link to comment https://forums.phpfreaks.com/topic/130192-mod-rewrite-for-url/#findComment-675238 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.