hedgehog90 Posted October 6, 2010 Share Posted October 6, 2010 I own a games wbesite called gpstudios.com I want to make it so that instead of loading pages with .php?id=xxx, they load with /id This is what I've tried so far: RewriteEngine on RewriteRule ^play/([0-9]+) playgame.php?gameid=$1 I want to change playgame.php?gameid=200 to play/200 But if I type http://www.gpstudios.com/play/200 I get a white page, with only the ads displaying correctly. No other images are loading. Also, I thought through this technique it would work both ways, but when I type in http://www.gpstudios.com/playgame.php?gameid=200 and load the page, the address doesn't change. How do I make it so that the address converts http://www.gpstudios.com/playgame.php?gameid=200 into http://www.gpstudios.com/play/200 ??? Help, please. Quote Link to comment https://forums.phpfreaks.com/topic/215292-rewriterule-not-working/ Share on other sites More sharing options...
Adam Posted October 6, 2010 Share Posted October 6, 2010 There doesn't appear to be a problem with the rewrite rule, but you're using relative paths to your external JavaScripts and stylesheets. For example: <link href="style.css" rel="stylesheet" type="text/css" /> The browser will try to find the stylesheet relative from the current URL, effectively "play/200/style.css". You need to use an 'absolute' path that doesn't need to change in any directory... For example: <link href="/style.css" rel="stylesheet" type="text/css" /> That will look for "style.css" within the document root. Quote Link to comment https://forums.phpfreaks.com/topic/215292-rewriterule-not-working/#findComment-1119616 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.