My host company is brinkster and I have multiple domain names (ie www.abc.com,www.xyz.com etc ), their tech.staff gave me following code to redirect a domain. My question is : if I am using following code, is my domain will be search engine friendly?
%26lt;html%26gt;
%26lt;head%26gt;
%26lt;title%26gt;Redirect Script with JavaScript%26lt;/title%26gt;
%26lt;script language=javascript%26gt;
var whois=location+%26quot; %26quot;
if (whois.indexOf(%26quot;yourdomain.com%26quot;) != -1)
{ window.location =%26quot;page1.html%26quot; }
if (whois.indexOf(%26quot;www.yourdomain.com%26quot;) != -1)
{ window.location =%26quot;page1.html%26quot; }
if (whois.indexOf(%26quot;yourotherdomain.com%26quot;) != -1)
{ window.location =%26quot;page2.html%26quot; }
if (whois.indexOf(%26quot;www.yourotherdomain.com%26quot;... != -1)
{ window.location =%26quot;page2.html%26quot; }
if (whois.indexOf(%26quot;subdomain1.yourdomain.co... != -1)
{ window.location =%26quot;page3.html%26quot; }
if (whois.indexOf(%26quot;subdomain2.yourdomain.co... != -1)
{ window.location =%26quot;page4.html%26quot; }
%26lt;/script%26gt;
%26lt;/head%26gt;
%26lt;body%26gt;
%26lt;/body%26gt;
%26lt;/html%26gt;
Redirect a Domain by Using Code?
You should really being be using server side code to properly implement a redirect - do not rely on the client side.
Populate an .htaccess file with all the redirects in place and upload it to the root of your doamin name.
Your web server will then read the .htaccess file every time your domain is hit and act accordingly.
No comments:
Post a Comment