whtpost
11-20-2002, 12:18 PM
What is the easiest way to accomplish the following:
When sometimes types site1.com in a browser they are automically redirected to site2.com and the url address in the browser changes to site2.com as well.
CPanel has redirection but the url address stays as site1.com.
Thanks
AussieHosts
11-20-2002, 12:35 PM
One easy way is an index page at site1.com with the following header:
<?
header('Location: http://www.site2.com');
exit;
?>
Regards
Gary
alpine
11-20-2002, 03:01 PM
I like the meta - tag redirect, a little more coding but should help you out.
Check out this URL for help:
http://www.bitbucketheaven.com/code/redirect.shtml
Michael
_____________
email: michael@alpinecommerce.com
more info: www.alpinecommerce.com
What about an htaccess file for Mod ReWrite?
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.+\.)*domain1\.com$ [NC]
RewriteRule /?(.*) http://www.domain2.com/$1 [L,R]
Replace the obvious.
<HTML><HEAD><TITLE>Your TITLE here</TITLE>
<meta HTTP-EQUIV="Refresh" CONTENT="0; SITE2 URL"></HEAD>
<FRAMESET ROWS='100%,*' BORDER='0' FRAMEBORDER='0' FRAMESPACING='0'>
<FRAME SRC='SITE2 URL' NAME='mainframe' FRAMEBORDER='0' NORESIZE='noresize'
SCROLLING='AUTO'>
<FRAME FRAMEBORDER='0' SCROLLING='NO' NORESIZE='noresize'> </FRAMESET>
<NOFRAMES> <BODY> Sorry, you don't appear to have frame support.
<A HREF="SITE2 URL">Go here instead.</A> </BODY> </NOFRAMES> </HTML>
Place the above code in the top part of the index.html file in SITE1 directory
Insert the URL for SITE2 as indicated above.
Then if someone goes to Site1 they get taken to Site 2 with Site 2 URL in the browser.
AussieHosts
11-20-2002, 09:10 PM
Originally posted by alpine
I like the meta - tag redirect, a little more coding but should help you out.
I have always used that when I needed a quick redirect as well. However the header "location" was posted to our forum recently, with the following comment:
"Yeah, I always use the location header for redirection, it's so much better than a meta tag. The bonus is that it works with every browser I've seen and search engines will also take notice as well."
Something worth noting for sure.
Regards
Gary
trafficbuild
11-20-2002, 10:46 PM
Originally posted by Zen
<HTML><HEAD><TITLE>Your TITLE here</TITLE>
<meta HTTP-EQUIV="Refresh" CONTENT="0; SITE2 URL"></HEAD>
<FRAMESET ROWS='100%,*' BORDER='0' FRAMEBORDER='0' FRAMESPACING='0'>
<FRAME SRC='SITE2 URL' NAME='mainframe' FRAMEBORDER='0' NORESIZE='noresize'
SCROLLING='AUTO'>
<FRAME FRAMEBORDER='0' SCROLLING='NO' NORESIZE='noresize'> </FRAMESET>
<NOFRAMES> <BODY> Sorry, you don't appear to have frame support.
<A HREF="SITE2 URL">Go here instead.</A> </BODY> </NOFRAMES> </HTML>
Place the above code in the top part of the index.html file in SITE1 directory
Insert the URL for SITE2 as indicated above.
Then if someone goes to Site1 they get taken to Site 2 with Site 2 URL in the browser.
redirecting is bad for SEO, but you still can add some optimisation text in the <noframes> in order to catch some search engine attention.