Script for page redirect

bluent's Avatar, Join Date: Nov 2005
Newbie Member
Hi Guys

Before a month I got a script for page redirection from somewhere in the forums.

var pAddy = self.location.href;
var pHost = self.location.hostname;
var pPath = self.location.pathname;
var nuLoc = 'http:/' + '/www.' + pHost + pPath;
if(pHost.indexOf('www.') == -1) self.location.replace(nuLoc);

save this file on server name it, suppose abc.js

Then call this .js page to home page of your website
<SCRIPT language="JavaScript" src="abc.js"> </SCRIPT>

It really works.

Now I would like to know, does it effect my website in one or other way. If anybody knows about this script and its cons please reply this post.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
First of all I would like to make a note that you have posted this in the wrong forum and I have moved it to the correct forum.

Now about your query the redirect that you are doing is a JavaScript errors and it has its advantages and disadvantages. The disadvantages are the search engine bots dont read the javascript and so they will not be redirected to the destination page and they will be getting page as blank and so may consider your site as not a site of good content. So its always good to show the same thing to the user as well as to the SE bots. NBow if there is any specific requirements like detect the user country and redirecting him then thats fine Script.

Also if you are looking for a redirect then I would suggest go for permanent redirect as that helps in gaining Page Rank as well as backlinks to a page.