Dead domain re-direct -
MP2 - 31.01.2013
I have two domains. Let's call them domain1 and domain2. Domain2 is an
addon domain to domain1. I have moved all the files from domain1 to the domain2 folder inside domain1's file directory, and everything works perfectly, BUT.. I need to re-direct the old domain to the new one, so if someone goes to
www.domain1.net/hello
it will re-direct to
www.domain2.net/hello
and I don't just mean for certain URLs like above. I mean EVERY URL. Also, can this be done for images also? I've posted images on these forums (and elsewhere) from domain1 and would like them to still show.
If anyone could help me with this I'd appreciate it a heap. Thanks.
Re: Dead domain re-direct -
Steven82 - 31.01.2013
Copied this off a website, currently using this to set my "/blog" as my main domain instead of the actual one.
PHP код:
<?php
/* Redirect browser */
header("Location: http://theos.in/");
/* Make sure that code below does not get executed when we redirect. */
exit;
?>
Source:
This Website
Re: Dead domain re-direct -
MP2 - 31.01.2013
If that's php code, that means it'll be in a php file, but users aren't going to get to that php file if they're going to a link to an image?
Re: Dead domain re-direct -
Steven82 - 31.01.2013
Quote:
Originally Posted by MP2
If that's php code, that means it'll be in a php file, but users aren't going to get to that php file if they're going to a link to an image?
|
I'm no expert or even have basic knowledge on PHP. I wish I could help ya out some more, I'll ****** around a bit
Re: Dead domain re-direct -
MP2 - 31.01.2013
It needs to be something in .htaccess I assume (I know NOTHING about this D:)
EDIT:
RewriteEngine on
RewriteRule ^(.*)$
http://www.newdomain.com/$1 [R=301,L]
:D So simple!
Thanks for trying to help anyway.
Re: Dead domain re-direct -
Steven82 - 31.01.2013
Quote:
Originally Posted by MP2
It needs to be something in .htaccess I assume (I know NOTHING about this D
EDIT:
RewriteEngine on
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
 So simple!
Thanks for trying to help anyway.
|
Gonna keep that somewhere for future references. No problem, and thank you
Re: Dead domain re-direct -
Sinner - 01.02.2013
.htaccess files work for any file or directory, so you're deffinately right there. Redirecting an entire website to another URL with .htaccess works as followed:
Source:
http://www.htaccessredirect.co.uk/
Rewriterule is to format the urls differently I think. (for example website.com/?p=page to website.com/page)
Re: Dead domain re-direct -
Michael@Belgium - 01.02.2013
Can i ask something .. it's about domains also. But how should link my payed domain to a VPS ..
Re: Dead domain re-direct - Riddy - 01.02.2013
Quote:
Originally Posted by Michael@Belgium
Can i ask something .. it's about domains also. But how should link my payed domain to a VPS ..
|
You need to setup a DNS client on your VPS. Then, you gotta setup nameservers both on the VPS and then your domain CP (Atleast, I had to do it on a Windows 2008 R2 server).
Re: Dead domain re-direct -
Michael@Belgium - 01.02.2013
Quote:
Originally Posted by Riddy
You need to setup a DNS client on your VPS. Then, you gotta setup nameservers both on the VPS and then your domain CP (Atleast, I had to do it on a Windows 2008 R2 server).
|
Ok i got 2 nameservers on the domain already, but indeed i have to do something on the VPS. The OS of the VPS is Centos 5. And idk a dns client or dns server ?