I have been wondering about this question for a while, and would like to ask others for their personal opinions. Are internal Javascript redirects in the headers of web pages allowed by the SE's? I have heard both that they are allowed and that they aren't allowed. Some claim that Google will ban them. Can we back either claim with anyone's personal experience?
IMO, I think your site will not ban, but dont expect a higher rank. javascript redirect is not OK, actually javascript itself is not SE friendly. the only good redirect is by 301 (permanent redirect). Cheers!
Re: 301 redirects, can anyone post some information about the impact of 302 redirects? Why is it that 301 are so widely recommended vs. 302? thanks! LC
Because a 302 is a "temporary redirect", meaning that "this page has moved temporarily but will be back to the original location shortly" - this is in a sense an instruction to SEs NOT to update their indicies. A 301 is a "permanent redirect" which says that "this page has moved permanently - please update your indices". There is more than one way to accomplish a 301 redirect, however. The most common is a directive in the .htaccess file for Apache servers. But if you don't have access to that file, try one of these: 301 redirect in PHP To use the following PHP code you must change the file extension of the file you will be using to index.php instead of index.html. Now put the following code into your new index.php page, put ONLY this code, no need for <head>, <body> or any other tags. Change www.newdomain.com/page.html to the url the page will be redirecting to <?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.newdomain.com/page.html"); exit(); ?> Code (markup): 301 redirect in ASP (Microsoft web servers) To use the following ASP code you must change the file extension of the file you will be using to default.asp instead of default.html. Now put the following code into your new default.asp page, put ONLY this code, no need for <head>, <body> or any other tags. Change www.newdomain.com/page.html to the url the page will be redirecting to <% response.Status = "301 Moved Permanently" response.addheader "location", "http://www.newdomain.com/page.html" response.end %> Code (markup):
Thanks for the info minstrel... very helpful. We actually do only 301's for our site (old pages -> new URL's) but I've seen some people doing 302's and wondered what the point was. LC
Most servers default to a 302, so unless you specify that it's a 301 (permanent) redirect then you get a 302. Most people use 302's simply because they don't know any better. I don't actually know of a real use for 302 redirects, there must be one else it wouldn't exist. You'll find many people (on these foums and elsewhere) will swear until they're blue in the face that there's nothing wrong with a 302 redirect. Trust me there is - there is nothing more sickening than running a search and finding someone elses url come up where yours should be. It took me 3 or 4 months to get rid of that problem and it cost me in SERPs and PR. My site still hasn't quite recovered yet.
Thanks for the add'l detail jlawrence. Fortunately we've always done 301's. I guess it's reassuring to hear first-hand evidence of how changing from 302's to 301's had a positive impact on someone's SEO efforts. LC
Well you are certainly a wealth of information! so... maybe you know the answer to my glitch question?? i have a couple of page names with spaces which I want to rename to hyphens but when I tried the .htaccess redirecting from the xxx xxx.htm to the xxx-xxx.htm it shut down my whole site!!! I tried putting in the %20 like what shows up in the webaddress of those pages and my site came back but it just didn't work (page not found) so would one of these other options work for this where the htaccess file doesn't or is there a workaround for this or do I just live with my current dual identityl.... the old copy there for the search engines that have that page indexed and the new name on the site? TIA Lisa
I'm not sure why your htaccess solution would have crashed your site -- I'm not an htaccess expert but if you want to post it here I and others can have a look at it. It may be something to do with the order of statements in the file... But if it's only a couple of files that have the blanks, your suggestion of using a PHP redirect or even a meta refresh should do it... the PHP or ASP solutions are probably better if your host supports one of those languages. If not, try the meta refresh... put the following tag at the top of the <head> section of your page: <META HTTP-EQUIV="REFRESH" CONTENT="10; URL=http://www.yoursite.com/newpagename.htm"> Code (markup): The 10 there is number of seconds -- don't make it shorter than 10 seconds or you may appear to be trying something sneaky. Even better would be to replace the old content with a simple statement for visitors and bots alike, such as is used in the following page: <HTML> <HEAD> <META HTTP-EQUIV="REFRESH" CONTENT="10; URL=http://www.yoursite.com/newpage.htm"> <TITLE>This page has moved</TITLE> </HEAD> <BODY> <BASEFONT SIZE="4"> <P align="center"><B> <FONT face="Arial,Times New Roman,MS Sans Serif,Georgia,Trebuchet MS" size="6" color="#5F9EA0">This Page Has Moved<BR> </FONT></B> <BR> <B><FONT size="4">Please update your bookmarks to </FONT></B> <P><B><FONT size="4"><A href="http://www.yoursite.com/newpage.htm"> http://www.yoursite.com/newpage.htm</A></FONT></B></P> <P> </BODY> </HTML> Code (markup):
Thanks, I'll try one of the other ways - replace the htaccess with a php and see if it works - I'll let you (collective you) know in case someone else has this problem. as far as I know the htaccess was fine - I already had 5 lines of redirection in there that was working well until I added the last line with the space in the file name. The site went down, I called the isp, they told me it was my htaccess file, I took the last line out and the site came back. Just to confirm, I tried it again and the same thing happened. Apparently a space in a file name seems to really freak something out! Lisa