I recently created a new site on a different domain. I need to redirect the index.html
of the old domain to the index of the new domain.
Usually this would
JAVASCRIPT REDIRECT:
Paste this at the top of your page on the old site just after the <head>
tag.
<script type="text/javascript">
window.location = "http://www.newsite.com/"
</script>
Naturally, you'd replace "http://www.newsite.com/" with wherever you wanted the page to redirect to.
It should redirect you instantly. So anyone visiting the old site page will instantly redirect to newsite.com
PHP REDIRECT (301, permanently moved):
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.newsite.com/" );
?>
Place that at the top of your page. It isn't as nice as the javascript one, but it is SEO FRIENDLY, which I think you're looking for.
You can try mod_rewrite for more flexibility with the code like this:
Options +FollowSymlinks -MultiViews
RewriteEngine on
# for HTTP
RewriteCond %{HTTP_HOST} ^a\.com$ [NC]
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(index\.html)$ http://b.com/$1 [R=301,L,NC]
# for HTTPS
RewriteCond %{HTTP_HOST} ^a\.com$ [NC]
RewriteCond %{SERVER_PORT} =443
RewriteRule ^(index\.html)$ https://b.com/$1 [R=301,L,NC]