nonexistentera Posted June 10, 2009 Share Posted June 10, 2009 Alright Im not to sure if this is more of a rewrite issue or a PHP issue. I have seen this with different rewrite addons for SMF and other projects. I have RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?action=$1 [L,QSA] Now it works when I goto /resource as it shows index.php?action=resource. But I am wondering how to force anyone that goes to index.php?action=resource to be redirected to /resource. Im not sure if this can be accomplished with rewrite, but if so that would be awesome. Thanks in advance, -nonexistentera Quote Link to comment https://forums.phpfreaks.com/topic/161615-solved-indexphpgetresource-force-redirect-to-resource/ Share on other sites More sharing options...
ngreenwood6 Posted June 10, 2009 Share Posted June 10, 2009 I am not sure that I follow you exactly but couldnt you just redirect them from the index.php page if the action=resource. For example: if($_GET['action'] == 'resource') { header('Location: http://www.example.com/resource'); } Quote Link to comment https://forums.phpfreaks.com/topic/161615-solved-indexphpgetresource-force-redirect-to-resource/#findComment-852810 Share on other sites More sharing options...
nonexistentera Posted June 10, 2009 Author Share Posted June 10, 2009 Well the main problem that I am getting with that is a never-ending loop. index.php?action=resource is equal so it will redirect to /resource. But action is still equal to resource so it will redirect again, just continuing. Im not sure what to do but I am going to go over some modules that have worked and see what makes them tick. XD Quote Link to comment https://forums.phpfreaks.com/topic/161615-solved-indexphpgetresource-force-redirect-to-resource/#findComment-852822 Share on other sites More sharing options...
ngreenwood6 Posted June 10, 2009 Share Posted June 10, 2009 It should not be a never ending loop unless you are passing the action=resource back through the url. It will only show the action=resource if it is passed through the url. Quote Link to comment https://forums.phpfreaks.com/topic/161615-solved-indexphpgetresource-force-redirect-to-resource/#findComment-852833 Share on other sites More sharing options...
nonexistentera Posted June 10, 2009 Author Share Posted June 10, 2009 Well im guessing it is still being passed since the rewrite calls the same url, just in 'pretty' terms. Quote Link to comment https://forums.phpfreaks.com/topic/161615-solved-indexphpgetresource-force-redirect-to-resource/#findComment-852838 Share on other sites More sharing options...
nonexistentera Posted June 11, 2009 Author Share Posted June 11, 2009 bump :] Quote Link to comment https://forums.phpfreaks.com/topic/161615-solved-indexphpgetresource-force-redirect-to-resource/#findComment-854052 Share on other sites More sharing options...
nonexistentera Posted June 11, 2009 Author Share Posted June 11, 2009 Finally got it. You can close this topic I decided to use the requested URI, then this doesn't create an endless lood, as once it gets to the 'pretty' page, it stops $text = $_SERVER['REQUEST_URI']; if (preg_match("/\baction=\b/i", $text)) { header('Location: http://www.x00n.com/' . $_GET['action']); } else { } Quote Link to comment https://forums.phpfreaks.com/topic/161615-solved-indexphpgetresource-force-redirect-to-resource/#findComment-854064 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.