smith.james0 Posted January 12, 2014 Share Posted January 12, 2014 Evening I need to set up a redirect from /included/bee.php?id=XXX to /bee.php?ID=XXX But I need to keep the variable as well, the variable does change case it's not a typo. I have tried this, but it's not working. RewriteEngine On RewriteRule ^/bee.php?ID=([^/d]+)?$ /included/bee.php?id=$1 [L,QSA] Can anyone point me in the right direction? James Quote Link to comment https://forums.phpfreaks.com/topic/285313-redirect-question/ Share on other sites More sharing options...
smith.james0 Posted January 12, 2014 Author Share Posted January 12, 2014 I have also tried this RewriteEngine on RewriteCond %{QUERY_STRING} ?id=(/d+) RewriteRule ^included/bee\.php$ bee.php?id=%1 [R=301,L] but that stops the whole site working..... James Quote Link to comment https://forums.phpfreaks.com/topic/285313-redirect-question/#findComment-1464973 Share on other sites More sharing options...
kicken Posted January 12, 2014 Share Posted January 12, 2014 The query string variable does not contain the ?, so leave that out. Also it's \d, not /d. RewriteCond %{QUERY_STRING} id=(\d+) RewriteRule included/bee\.php$ bee.php?id=%1 [R=301,L] Quote Link to comment https://forums.phpfreaks.com/topic/285313-redirect-question/#findComment-1464987 Share on other sites More sharing options...
smith.james0 Posted January 12, 2014 Author Share Posted January 12, 2014 Thanks, but it's redirecting to the following address causing a 404 error http://www.beekeepinglinks.co.uk/home/xr2457b/public_html/beekeepinglinks.co.uk/bee.php?id=385 James Quote Link to comment https://forums.phpfreaks.com/topic/285313-redirect-question/#findComment-1464999 Share on other sites More sharing options...
smith.james0 Posted January 12, 2014 Author Share Posted January 12, 2014 I changed it to the following at it works RewriteCond %{QUERY_STRING} id=(\d+) RewriteRule included/bee\.php$ http://www.beekeepinglinks.co.uk/bee.php?ID=%1 [R=301,L] Quote Link to comment https://forums.phpfreaks.com/topic/285313-redirect-question/#findComment-1465000 Share on other sites More sharing options...
smith.james0 Posted January 13, 2014 Author Share Posted January 13, 2014 Update, the code above only works with Safari, Firefox won't redirect. Why would it work for one and not the other? James Quote Link to comment https://forums.phpfreaks.com/topic/285313-redirect-question/#findComment-1465098 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.