killah Posted February 24, 2009 Share Posted February 24, 2009 Hi, i am trying to make my page's go like this game/viewuser/99 when viewing some one's profile or game/base/buy/44 when buying something from base.php Any idea's how i can do this with mod rewrite? Quote Link to comment https://forums.phpfreaks.com/topic/146702-mod-rewrite-help/ Share on other sites More sharing options...
corbin Posted February 24, 2009 Share Posted February 24, 2009 Short answer: RewriteRule ^game/viewuser/([\d]+)$ /view.php?user_id=$1 RewriteRule ^game/base/buy/([\d]+)$ /base.php?act=buy&item_id=$1 (Or if you want the second thing to be dynamic: RewriteRule ^game/base/([^/]+)/([\d]+)$ /base.php?act=$1&item_id=$2 Quote Link to comment https://forums.phpfreaks.com/topic/146702-mod-rewrite-help/#findComment-770593 Share on other sites More sharing options...
killah Posted February 24, 2009 Author Share Posted February 24, 2009 Hey, um with that. My css and image's are not showing. I read it some where how to fix this. But i lost i now. Any idea's? Quote Link to comment https://forums.phpfreaks.com/topic/146702-mod-rewrite-help/#findComment-770646 Share on other sites More sharing options...
corbin Posted February 25, 2009 Share Posted February 25, 2009 Use absolute paths. Paths are resolved relative to the directory, so if you have something like: "css/style.css" It will try to load /game/viewuser/1/css/style.css (or what ever), and that's obviously not what you want. Yes, you could do some rewrite stuff to make relative paths work, but it would kill caching. Just use absolute paths (IE "/css/style.css"). Quote Link to comment https://forums.phpfreaks.com/topic/146702-mod-rewrite-help/#findComment-770719 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.