konetch Posted May 11, 2009 Share Posted May 11, 2009 Hey, This isn't a PHP question, but I was wondering how you redirected to a directory with out using a meta tag in and index.html file. For example the site http://www.sumopaint.com automatically redirects you to http://www.sumopaint.com/web. How would you do this? Thanks Alex Konetchy Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/ Share on other sites More sharing options...
Maq Posted May 11, 2009 Share Posted May 11, 2009 Then why are you posting in the PHP section? What language do you want to redirect in, HTML, Javascript? Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/#findComment-831958 Share on other sites More sharing options...
gevans Posted May 11, 2009 Share Posted May 11, 2009 javascript forum! Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/#findComment-831960 Share on other sites More sharing options...
konetch Posted May 11, 2009 Author Share Posted May 11, 2009 Oh sorry, I couldn't find another forum it could fit under. Anyway, I wanted the server to do it automatically. Originally I put this in the index.html file in the home directory: <html> <head> <title>Redirect | KonetchReport</title> <META http-equiv="refresh" content="0;URL=http://www.konetchreport.com/forum"> </head> <body> <div align="center"> <a href="http://www.konetchreport.com/forum">Click this link if the page didn't show up in your browser</a> </div> </body> </html> But everyone see this. So I wanted it to not appear on this page at all and just open into that directory at once. Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/#findComment-831961 Share on other sites More sharing options...
gevans Posted May 11, 2009 Share Posted May 11, 2009 In which case you're in the right place, you need to do this using php. Does your server support php, and have you ever used php? If both those questions answer yes here's a starting point... <?php header('Location: http://www.konetchreport.com/forum'); Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/#findComment-831963 Share on other sites More sharing options...
The Little Guy Posted May 11, 2009 Share Posted May 11, 2009 header("Location: somepage.php"); // OR header("refresh: 5; somepage.php"); Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/#findComment-831964 Share on other sites More sharing options...
Maq Posted May 11, 2009 Share Posted May 11, 2009 You could also do an .htaccess redirect, which may be the smoothest. Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/#findComment-831965 Share on other sites More sharing options...
konetch Posted May 11, 2009 Author Share Posted May 11, 2009 Yeah. I do have some experience in php. I use it as content management, and for other simple functions, but I'm definitely not a professional with it. And yes my server does support PHP @maq I never worked with .htaccess files either, since I never had to use them Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/#findComment-831969 Share on other sites More sharing options...
konetch Posted May 11, 2009 Author Share Posted May 11, 2009 @gevans That code you gave me works great. I know that PHP is server side so will it work on all browsers? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/#findComment-831972 Share on other sites More sharing options...
Adam Posted May 11, 2009 Share Posted May 11, 2009 Yeah, it's processed server side so it doesn't matter which browser they are using. Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/#findComment-831977 Share on other sites More sharing options...
konetch Posted May 11, 2009 Author Share Posted May 11, 2009 Okay, thanks everyone Quote Link to comment https://forums.phpfreaks.com/topic/157738-solved-reidrecting-automatically/#findComment-831981 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.