Jump to content

Redirecting


knystrom18

Recommended Posts

Hey,I have two domains, but want visitors to see the same site when they type in either one. Do I have to have all my site's files hosted on both domains respective web spaces? Or can I redirect one to the other and only have the files hosted in one domains space?If I can just redirect, would someone kindly point me in the right direction?Thanks,- K

Link to comment
Share on other sites

pick one host for the files. make the index for the other one a php script that redirects to the host where the "real" files are hosted.

Link to comment
Share on other sites

You can redirect in a couple of ways, by a simple header() statement from one site to the other, or by using .htaccess (which is a better way). You'll probably want to do a "301 redirect", which search engines will recognize as "moved permanently". PHP Redirect: <?Header( "HTTP/1.1 301 Moved Permanently" );Header( "Location: http://www.newdomain.com" );?>.htaccess Redirect:Options +FollowSymLinksRewriteEngine onRewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

Link to comment
Share on other sites

Aight, thanks guys.End User:The only text that needs to change is bold?And another question: Do I need to set nameservers for the new domain?

Link to comment
Share on other sites

To resolve the domain it has to be stored on a nameserver somewhere. So yeah. I mentioned this in another thread but won't it just be easier to do the redirection through your DNS?

Link to comment
Share on other sites

That might be an easier way but even if it is easier I still don't fully know how to do any of the methods discussed in this thread. I'd much rather get in the habit of doing it the right way instead of doing it the easy way.

Link to comment
Share on other sites

That is understood but domain name resolution should be handle by dns.Whoever provides you with your nameservers or dns should have an option to "add an Alias or Host". The reason I say this is easier because it can become possible to block .htaccess redirects with the correct code.

Link to comment
Share on other sites

Ah, word. I use DomainSite for buying my domains. I haven't seen that option, but then again, I haven't looked before. I'm sure they have it somewhere.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...