Guest NicoleMurruni Posted January 22, 2013 Share Posted January 22, 2013 When trying to view our website from a mobile phone or an iPad, it redirects to another website which does not exist. I can see where the redirection is taking place in the index.php file, but I do not know what I need to remove in order for the redirect to stop. From a mobile device or iPad it should just go to our normal website, www.u-a-s.com, we do not have a mobile version as of yet. I tried a few things, but do not know enough to know what to take out. Can anyone help? Here is the code: ************************ $ua = $_SERVER['HTTP_USER_AGENT']; if ( stristr($ua, "Windows CE") or stristr($ua, "AvantGo") or stristr($ua,"Mazingo") or stristr($ua, "Mobile") or stristr($ua, "T68") or stristr($ua,"Syncalot") or stristr($ua, "Blazer") ) { $DEVICE_TYPE = "MOBILE"; } if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") { header ("Location:http://lahori.org/mydev/universal/mobile/"); exit; } define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/ Share on other sites More sharing options...
Jessica Posted January 22, 2013 Share Posted January 22, 2013 You seriously looked at that and don't know what to remove? Do you know any PHP at all? Remove the line that has the URL that doesn't exist... Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1407475 Share on other sites More sharing options...
Guest NicoleMurruni Posted January 22, 2013 Share Posted January 22, 2013 No need to be rude. No I do not know php very well, I am not that dumb though. I tried to remove the website that does not exist and it still says too many redirects when trying to load on the phone. Our web guy up and left, and left us basically stranded. Doing the best I can with what I know but this is one thing I have not been able to fix no matter what I do. I even tried replacing the website that does not exist with the good one, and that still says too many redirects. Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1407478 Share on other sites More sharing options...
Jessica Posted January 22, 2013 Share Posted January 22, 2013 I'm not being rude, it was a serious question. This forum is for help with code YOU wrote. if ( stristr($ua, "Windows CE") or stristr($ua, "AvantGo") or stristr($ua,"Mazingo") or stristr($ua, "Mobile") or stristr($ua, "T68") or stristr($ua,"Syncalot") or stristr($ua, "Blazer") ) { $DEVICE_TYPE = "MOBILE"; } if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") { header ("Location:http://lahori.org/mydev/universal/mobile/"); exit; } ?> Remove all of that. If you tried that already, you should have said so in your original post. Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1407481 Share on other sites More sharing options...
Guest NicoleMurruni Posted January 22, 2013 Share Posted January 22, 2013 I really appreciate you trying to help. Unfortunately I did not write the code, and the person who did took our money and left us completely. I removed everything as you said and then when I tried to access the website on a pc nothing, it did not come up. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1407492 Share on other sites More sharing options...
Jessica Posted January 22, 2013 Share Posted January 22, 2013 There must be more code then. I suggest A. Hire someone who knows what they're doing. B. Hire a lawyer. C. Learn from the mistake. Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1407495 Share on other sites More sharing options...
Jessica Posted January 22, 2013 Share Posted January 22, 2013 Which is your site, u-a-s.com or lahori.org?? Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1407496 Share on other sites More sharing options...
help_me_with_php Posted January 27, 2013 Share Posted January 27, 2013 (edited) Nicole, if you're still subscribed this (and haven for bid haven't solved this already), "header" is the re-direct function in PHP that is causing the problem more than likely. it's a built-in resource. Jessica? one comment and this would have been over. what's up? how was your day? Nicole, hopefully this answers the question and sends you on your marry way. By the way, PHP, like all other languages is incredibly complex and you have to do your own organization of the documentation material or you'll spend hours trying to sort through it all. Don't worry about that (I just wanted to mention this to you). Heck, I talked to a professor at a 4-year school today and HE even said that academic scholars can't even figure out a way to do it!! I hope that helps. It's not a tough problem and obviously deserves a one-liner answer. Might be a good idea for you to start learning the sites that help with this stuff. start with: www.php.net everything you could possibly want to know is there. Edited January 27, 2013 by help_me_with_php Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1408472 Share on other sites More sharing options...
trq Posted January 27, 2013 Share Posted January 27, 2013 "header" is the re-direct function in PHP No it is not. If you look at the manual entry for header you will note that it is used to send HTTP headers to the client. Sure, one or more of these *headers* are then responsible for forcing the client to be redirected, but saying that the header function is the "re-direct" function is not correct. Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1408481 Share on other sites More sharing options...
help_me_with_php Posted January 27, 2013 Share Posted January 27, 2013 No it is not. If you look at the manual entry for header you will note that it is used to send HTTP headers to the client. Sure, one or more of these *headers* are then responsible for forcing the client to be redirected, but saying that the header function is the "re-direct" function is not correct. trq, I wish I had the funding to hire you. Based on what I've seen and your site, sems like you can curb the stuff that creeps in and produce great stuff. Is that not correct? by the way, the OP wouldn't understand anything about what you said. Sure I could research it and say the same thing, but why make someone feel bad? That's not a way to create bridges with people. Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1408483 Share on other sites More sharing options...
trq Posted January 27, 2013 Share Posted January 27, 2013 And giving people misinformation is helpful how? Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1408486 Share on other sites More sharing options...
help_me_with_php Posted January 27, 2013 Share Posted January 27, 2013 And giving people misinformation is helpful how? last post. take care bud. thanks for the clarification! Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1408487 Share on other sites More sharing options...
Christian F. Posted January 27, 2013 Share Posted January 27, 2013 (edited) I assume lahori.org was the developer(s) hired, at least it would seem that way from the site on said address. Disregarding their horrible site, which should serve as a warning to not hire those guys/that guy, you might want to take Jessica's advice. Hire someone who really knows what they're doing, and have them go over the custom code added by the previous coder. If you removed the code pointed out by Jessica, uploaded the changes, and didn't see any change. Then there must be some other redirect hidden in the system somewhere. A search for the string "Location:" should reveal it. Remember to look closely at the surrounding code though, as should be quite a few legitimate uses of a header redirect in WP as well. Edited January 27, 2013 by Christian F. Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1408516 Share on other sites More sharing options...
Jessica Posted January 27, 2013 Share Posted January 27, 2013 I didn't actually go to the sites, you never know what people might post here. Yesterday I had to hide a spam comment that actually had photographic porn in it. Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1408529 Share on other sites More sharing options...
Christian F. Posted January 27, 2013 Share Posted January 27, 2013 I don't blame you, and you didn't miss out on anything (valuable). Maybe a quick laugh, or a groan, but.. Only reason I went there, was because I'm confident in my securing of the browser; Nothing gets shown without my express permission. Also, after about 15 years of moderating/administrating a lot of different fora, channels and whatnot, I've seen just about anything. (Unfortunately.) So, yeah, I'm not surprised. Quote Link to comment https://forums.phpfreaks.com/topic/273487-mobile-redirection/#findComment-1408533 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.