steviez Posted February 16, 2008 Share Posted February 16, 2008 Hi, If someone goes to my site and navigates to: http://www.mysite.com/username it rewrites them to profile.php?user=username I need it to also work with user id, for example: http://www.mysite.com/235 would rewrite to: profile.php?user_id=235 Here is my current code: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/?$ /profile.php?user=$1 [L] Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/91397-rewrite-help/ Share on other sites More sharing options...
powerspike Posted March 18, 2008 Share Posted March 18, 2008 RewriteRule ^([0-9]+)/$ profile.php?user_id=$1 [L,NC] RewriteRUle ^([a-zA-Z0-9]+)/$ profile.php?user=$1 [L,NC] that should do it for you. Quote Link to comment https://forums.phpfreaks.com/topic/91397-rewrite-help/#findComment-494675 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.