ICONISE Posted March 6, 2007 Share Posted March 6, 2007 Hey guys, Im having a problem which hopefully you guys can help me out with. I have Dada mail installed on my website which works absolutely fine on my website if used from http://www.iconise.net But... if I use http://iconise.net problems start to occur. My hosts say that it is not possible to auto forward everything to http://www.iconise.net and they say I would need as php script to forward from http://iconise.net to http://www.iconise.net. The only forwarding script that i know is an OnLoad forward to.... but this causes a loop where the page refreshes, can someone please point me in the right direction on how to fix this please? Many thanks in advance. Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 6, 2007 Share Posted March 6, 2007 Save this as a php file and include it at the top of all your pages to force the user to the www path for all pages. <?php if ($_SERVER["SERVER_NAME"]=='http://iconise.net') { header("Location: http://www.iconise.net".$_SERVER["REQUEST_URI"]); } ?> Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted March 6, 2007 Share Posted March 6, 2007 mj is right, however, your host doesn't know what they're talking about... it IS possible to forward it. it's called mod_rewrite. also, it can be done with an apache configuration in the httpd.conf file. Quote Link to comment Share on other sites More sharing options...
ICONISE Posted March 6, 2007 Author Share Posted March 6, 2007 Save this as a php file and include it at the top of all your pages to force the user to the www path for all pages. <?php if ($_SERVER["SERVER_NAME"]=='http://iconise.net') { header("Location: http://www.iconise.net".$_SERVER["REQUEST_URI"]); } ?> I have tried this, although I cant get it to work. I have saved the php in a file called forward.php and im using: <?php require_once('forward.php'); ?> at the top of my web page. Is this right? Im pretty new to PHP so sorry if this is a little dumb. Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted March 6, 2007 Share Posted March 6, 2007 contact your hosting company and tell them they are retards. then ask to speak with a 'Level 2 Tech', and have them change it for you. this should be done on the server level, not the scripting level. Quote Link to comment Share on other sites More sharing options...
ICONISE Posted March 6, 2007 Author Share Posted March 6, 2007 I have spoke to support once again and they say that this is not possible on server level. They are using Zeus Web Servers. They cannot change mod_rewrite. as that is Apache only. Does anyone know a solution that can be achieved code wise? Quote Link to comment Share on other sites More sharing options...
jcbarr Posted March 6, 2007 Share Posted March 6, 2007 Get a new host...lol Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted March 6, 2007 Share Posted March 6, 2007 Get a new host...lol i agree. whoever your hosting company is... they are a discrace to the web hosting service and I.T. companies everywhere. they do NOT know what they are doing... and you do NOT want them in control of your site. Quote Link to comment Share on other sites More sharing options...
ICONISE Posted March 6, 2007 Author Share Posted March 6, 2007 Thanks for the advice, Im currently with Namesco. Im thinking of moving to 1and1. Any recommendations? Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 7, 2007 Share Posted March 7, 2007 Going to a better host would probably be a better solution. But, for now, what problems are you having using the above script? Any errors, or is it having no effect at all? Quote Link to comment Share on other sites More sharing options...
ICONISE Posted March 7, 2007 Author Share Posted March 7, 2007 It seems to be having no effect at all, all the code is in place and live on the website. http://iconise.net http://www.iconise.net Thanks for the help. Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 7, 2007 Share Posted March 7, 2007 Try using this to echo the value to the page, then set the value in the if statement: echo $_SERVER["SERVER_NAME"]; Quote Link to comment Share on other sites More sharing options...
ICONISE Posted March 7, 2007 Author Share Posted March 7, 2007 Yeah that has solved the problem, when I used: <?php echo $_SERVER["SERVER_NAME"]; ?> It returned 'iconise.net' without the 'http://' prefix. I simply removed the 'http://' prefix from the original code from Mjdamato The working code is: <?php if ($_SERVER["SERVER_NAME"]=='iconise.net') { header("Location: http://www.iconise.net".$_SERVER["REQUEST_URI"]); } ?> Many thanks to Mjdamato. Quote Link to comment 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.