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! 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. 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? 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. Link to comment https://forums.phpfreaks.com/topic/130192-mod-rewrite-for-url/#findComment-675238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.