phpSensei Posted March 12, 2008 Share Posted March 12, 2008 This is actually my first ever using Mod Rewrite, I was finally convinced by people to make my urls (e.g. ?u=Xwer3wr&e=2;c&user=2&ac=1) cleaner. So instead of using "http://www.website.com/users/?user=John" I would like it to be "http://www.website.com/users/John".. So I got this little Mod Rewrite which I don't know if it is correct, I tried it and no luck. RewriteEngine on RewriteMap user-to-host txt:/path/to/map.user-to-host RewriteRule ^/u/([^/]+)/?(.*) http://${user-to-host:$1|server0}/u/$1/$2 RewriteRule ^/([uge])/([^/]+)/?$ /$1/$2/.www/ RewriteRule ^/([uge])/([^/]+)/([^.]+.+) /$1/$2/.www/$3\ How would the code know if John is really a username or anything... or I want it to read ?username=John as John only, and so I can use the index.php file to validate the name. edit: Yay, I got back to programming.... It really hunts you back after awhile Link to comment https://forums.phpfreaks.com/topic/95724-mod-rewrite/ Share on other sites More sharing options...
phpSensei Posted March 12, 2008 Author Share Posted March 12, 2008 haha, I didnt know this section existed, sorry it was in the PHP section. Link to comment https://forums.phpfreaks.com/topic/95724-mod-rewrite/#findComment-490199 Share on other sites More sharing options...
powerspike Posted March 18, 2008 Share Posted March 18, 2008 RewriteRule ^users/([A-Za-z0-9]+)/$ users/index.php?user=$1 [L,NC] http://www.website.com/users/John/ i think that will do what you are asking it'll take the username out of the above url and put it in $1 for you. Link to comment https://forums.phpfreaks.com/topic/95724-mod-rewrite/#findComment-494674 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.