mvd7793 Posted September 2, 2007 Share Posted September 2, 2007 Hi. I'm interested in doing something like what follows in PHP. The user goes to www.mydomain.com/page.php. By default, it shows them an HTML page without leaving page.php. However, if the user enters page.php?id=1 , then it will redirect them to another page, such as http://www.google.com. ID 2 would be different and so on and so forth. Could you do this with a switch or something? Quote Link to comment https://forums.phpfreaks.com/topic/67592-solved-php-redirection/ Share on other sites More sharing options...
mvd7793 Posted September 2, 2007 Author Share Posted September 2, 2007 Just incase anyone cares, this will be used to download files that I put up. Quote Link to comment https://forums.phpfreaks.com/topic/67592-solved-php-redirection/#findComment-339546 Share on other sites More sharing options...
Fadion Posted September 2, 2007 Share Posted September 2, 2007 If i got this right then: <?php if(isset($_GET['id'])){ $id = $_GET['id']; if($id == 1){ header('Location: http://www.google.com'); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67592-solved-php-redirection/#findComment-339547 Share on other sites More sharing options...
mvd7793 Posted September 2, 2007 Author Share Posted September 2, 2007 That looks like it will work. I'll have to test it in a minute. What about the HTML page for no ID though? Quote Link to comment https://forums.phpfreaks.com/topic/67592-solved-php-redirection/#findComment-339552 Share on other sites More sharing options...
mvd7793 Posted September 2, 2007 Author Share Posted September 2, 2007 I got it to work now. If I just put that particular piece of code before the code of an HTML page, it works. Thanks a lot! Quote Link to comment https://forums.phpfreaks.com/topic/67592-solved-php-redirection/#findComment-339554 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.