# Old domain to new domain.



## Iomega0318 (Mar 12, 2007)

Not sure where this would go lol, but this seems like the best place.

First off let me say I haven't been here in a while and the new site looks good.

Now on to the fun bit,

I am going to be buying a new VPS soon and putting it under a new domain so I can cancel my old web host account.. however I have tons of links, pictures, files, etc hosted all over and linked back to my current domain.. the files will be moved to the new domain and keep the same structure, etc just be under a new name.. I will still keep my old domain primarily for use as my e-mail address since that's about all I use it for now..

Now here is what I would like to know if possible, I can host one page on my current domain once I downgrade what I would like to know would there be any way to add it in as html or php or something to make it do this:

Say you have a file hosted at the old domain,

```
http://downloads.yourdomainold.com/blah.zip
http://www.yourdomainold.com/blah/blah/blah.zip
```
and have it send you instead to:

```
http://doanloads.yourdomainnew.com/blah.zip
http://www.yourdomainnew.com/blah/blah/blah.zip
```
Any help would be awesome,
Thank you.


----------



## kilonox (Dec 3, 2010)

Are you looking to do a redirect script? If so,

<meta HTTP-EQUIV="REFRESH" content="5; url=http://www.yournewsite.com/blah/blah/blah.zip">


----------



## Iomega0318 (Mar 12, 2007)

Well sort of, but for multiple files from the old domain not just one link.


----------



## kilonox (Dec 3, 2010)

I am not sure what you mean. Like if you go to the old domain each file redirects to the new one?


----------



## sobeit (Nov 11, 2007)

if you can have multiple domains then just add the new nameserver to the domain. It should still access the pages under the new domain.


----------



## Laxer (Dec 28, 2010)

do a meta refresh like kilonox suggested but use a javascript or php in it.

basically what you will want to do....

Grab the url (mydomain.com/box.zip)

strip the part after your domain (box.zip)

append it to your new domain (mynewdomain.com/box.zip)

then apply the domain to a redirect like kilonox suggested:

<meta HTTP-EQUIV="REFRESH" content="5; url=mynewdomain.com/box.zip">


----------



## Iomega0318 (Mar 12, 2007)

I don't know why I'm not getting notified on replies, but anyways here goes..



kilonox said:


> I am not sure what you mean. Like if you go to the old domain each file redirects to the new one?


Yes


sobeit said:


> if you can have multiple domains then just add the new nameserver to the domain. It should still access the pages under the new domain.


Well they are on different hosts, and I wasn't sure if I could until now.


Laxer said:


> do a meta refresh like kilonox suggested but use a javascript or php in it.
> 
> basically what you will want to do....
> 
> ...


That would be awesome, and after extensive google searches I found nothing lol..




BUT!
I have some good news, I was talking to Yahoo about downgrading and here is what they told me:


Yahoo! said:


> Once you successfully downgrade your plan, you will see the option to forward your domain in the Domain Control Panel. You could set up a simple domain forward or edit A records or change nameservers, whichever is preferred by your hosting provider. To learn more about these options, please visit the following links:
> 
> Domain forward:
> How do I set up domain forwarding? - Yahoo! Small Business Help
> ...


Which would be the best option?
Say for example I have subdomains right now which forward to certain folders, all subdomains would be lost on downgrade and I would have just my regular name which will have the above options. I know how changing the name servers work and that would be a good way of pointing the main old domain to the new one but wont solve subdomain problems, will it?


----------



## kilonox (Dec 3, 2010)

In this case, you will need to use domain forwarding and change your name servers since you are using your own VPS.


----------



## Laxer (Dec 28, 2010)

What yahoo suggested may or may not work for you....

A forwarder just moves you to another domain, doesn't adjust every link....

for example if i went to: google.net

it just redirects me to google.com and the links still have the structure google.com/whatever....


----------



## Iomega0318 (Mar 12, 2007)

Laxer said:


> do a meta refresh like kilonox suggested but use a javascript or php in it.
> 
> basically what you will want to do....
> 
> ...


So back to this then lol?
Anyone know where to start on this..


----------



## magnethead (Mar 18, 2006)

Laxer said:


> do a meta refresh like kilonox suggested but use a javascript or php in it.
> 
> basically what you will want to do....
> 
> ...


Demo: http://magnet794.dyndns.info/URL_Test/URL_test.php


```
<?php

$urlString =  $_SERVER['REQUEST_URI'];

if ($_SERVER['HTTP_HOST'] == "magnet794.dyndns.info"){
$newURL = "magnethead794.com" . $urlString;
} 

if ($_SERVER['HTTP_HOST'] == "magnethead794.com"){
$newURL = "magnet794.dyndns.info" . $urlString;
}

//echo $newURL;

header("Location: http://" . $newURL);

?>
```


----------



## magnethead (Mar 18, 2006)

The only issue with the solution I posted, is that you can't run PHP scripts on a ZIP file extension by default.

simply modify .htaccess file


```
AddType application/x-httpd-php .zip
```
example: http://magnet794.dyndns.info/URL_Test/URL_test.zip

Notice it now performs as PHP script, not as a zip compressed folder.


----------

