Joshua F Posted May 1, 2011 Share Posted May 1, 2011 I'm trying to make forums.ws?1 load what would be thread.php?id=1 The code I have is below RewriteRule ^forums.ws?([0-9])$ thread.php?id=$1 It doesn't want to work because of the question mark. Quote Link to comment https://forums.phpfreaks.com/topic/235244-question-mark-in-url/ Share on other sites More sharing options...
requinix Posted May 1, 2011 Share Posted May 1, 2011 RewriteRule doesn't look at the query string. If you could adjust thread.php to work with thread.php?123 (protip: $_SERVER["QUERY_STRING"]) then it's simple: RewriteRUle forums.ws thread.php Otherwise you'll need a RewriteCond RewriteCond %{QUERY_STRING} ^(\d+)$ RewriteRule forums.ws thread.php?id=%1 Quote Link to comment https://forums.phpfreaks.com/topic/235244-question-mark-in-url/#findComment-1208935 Share on other sites More sharing options...
Joshua F Posted May 1, 2011 Author Share Posted May 1, 2011 Never used the code below, so I have absolutely no idea where to put it, or how to use it. Been googling it for a while, and still nothing. $_SERVER["QUERY_STRING"]; Quote Link to comment https://forums.phpfreaks.com/topic/235244-question-mark-in-url/#findComment-1209127 Share on other sites More sharing options...
wildteen88 Posted May 2, 2011 Share Posted May 2, 2011 $_SERVER["QUERY_STRING"]; is a PHP variable which returns the query string in the url. Quote Link to comment https://forums.phpfreaks.com/topic/235244-question-mark-in-url/#findComment-1209393 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.