fbemo Posted January 26, 2010 Share Posted January 26, 2010 Hi guys, I'm trying to create mass redirection as I keep on masking my own URLs. Below is the PHP Code: <?php $data = file('data.txt'); for ($i=0; $i<count($data); $i++) { $line = split(" ",trim($data[$i])); if ($line[0]==$_REQUEST["goto"]) { header("Location: ".$line[1]); break; }; }; ?> The data.txt file is below: redirect1 http://www.gotothisweb1.com redirect2 http://www.gotothisweb2.com redirect3 http://www.gotothisweb3.com redirect4 http://www.gotothisweb4.com Meaning, when people go to http://www.this-is-my-web.com/redirect1, it will go to http://www.gotothisweb1.com. So forth; http://www.this-is-my-web.com/redirect2 will redirect to http://www.gotothisweb2.com http://www.this-is-my-web.com/redirect3 will redirect to http://www.gotothisweb3.com http://www.this-is-my-web.com/redirect4 will redirect to http://www.gotothisweb4.com Is there anything I need to create such as .htaccess file? From this, it will make my work easier because when I need to create redirection, I just need to add URL to data.txt file. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/189813-mass-redirection-not-working-weird/ Share on other sites More sharing options...
teamatomic Posted January 26, 2010 Share Posted January 26, 2010 Yes, search google for something like htaccess SEO friendly link HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/189813-mass-redirection-not-working-weird/#findComment-1001663 Share on other sites More sharing options...
fbemo Posted January 26, 2010 Author Share Posted January 26, 2010 Yes, search google for something like htaccess SEO friendly link HTH Teamatomic Been looking for this before, but most of it not showing how to do mass redirection. Thanks anyway Quote Link to comment https://forums.phpfreaks.com/topic/189813-mass-redirection-not-working-weird/#findComment-1001669 Share on other sites More sharing options...
oni-kun Posted January 26, 2010 Share Posted January 26, 2010 Yes, search google for something like htaccess SEO friendly link HTH Teamatomic Been looking for this before, but most of it not showing how to do mass redirection. Thanks anyway Your definition of mass redirection is flawed. http://www.this-is-my-web.com/redirect2 will redirect to http://www.gotothisweb2.com http://www.this-is-my-web.com/redirect3 will redirect to http://www.gotothisweb3.com http://www.this-is-my-web.com/redirect4 will redirect to http://www.gotothisweb4.com Is what you want? #301 = Temp, 302 = Permanent Redirect 301 /redirect1 http://www.gotothisweb1.com Redirect 301 /redirect2 http://www.gotothisweb2.com Redirect 301 /redirect3 http://www.gotothisweb3.com Redirect 301 /redirect4 http://www.gotothisweb4.com I assume this is what you want to do, in .htaccess Quote Link to comment https://forums.phpfreaks.com/topic/189813-mass-redirection-not-working-weird/#findComment-1001679 Share on other sites More sharing options...
fbemo Posted January 26, 2010 Author Share Posted January 26, 2010 Great, I've just found it just now... but you wrote much better than I found. Thanks a lot oni-kun! You've been really helpful! *Is it really 302 = permanent? Quote Link to comment https://forums.phpfreaks.com/topic/189813-mass-redirection-not-working-weird/#findComment-1001780 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.