Go4Expert (http://www.go4expert.com/)
-   JavaScript and AJAX (http://www.go4expert.com/forums/javascript/)
-   -   Script for page redirect (http://www.go4expert.com/forums/script-page-redirect-t515/)

bluent 23Nov2005 17:26

Script for page redirect
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.

shabbir 23Nov2005 21:44

Re: Script for page redirect
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.

All times are GMT +5.5. The time now is 03:45.