Jump to content

[SOLVED] URL Forwarding Problem.


ICONISE

Recommended Posts

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.

 

Link to comment
Share on other sites

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"]);
}

?> 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.