Welcome to WebmasterWorld Guest from

Message Too Old, No Replies

Javascript redirect vs. 404 errors?



3:34 pm on Dec 11, 2011 (gmt 0)


I'm working with a client who has a custom CMS that does not currently allow for 301 redirects. There are a number of pages on the site with 404 erros, since they no longer exist, and we can't yet 301-redirect it (although that is in the works for the long term). Is it better to leave the 404's alone, or is it better to implement a javascript redirect, from an SEO perspective? I'm imagining that it's better to leave it for now, since js redirects are considered cloaking, but I'd appreciate any input.



4:01 pm on Dec 11, 2011 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

The first thing that comes to mind is that Google's guidelines talk about avoiding SNEAKY JavaScript redirects - they don't give a blanket condemnation to any and all JavaScript redirects. I think if you make everything very straightforward, and especially if you avoid internal links that point to the URL that no longer exists, you should be OK.

You probably have other options, too. For instance, until the CMS is all patched up, you might build the .htaccess file manually so you would have true 301 redirects. Also, you might use a meta-refresh, which is something Google now appreciates that some shared hosting situations make necessary. I've used the meta-refresh with a client site a couple years ago and it worked pretty well.


4:22 pm on Dec 11, 2011 (gmt 0)

Ok, great- thanks for the prompt response!


5:37 pm on Dec 11, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

If you can't add HEADER directives to the CMS scripts, you can build the same redirects in your .htaccess file using Mod_Rewrite RewriteRule directives.

Both methods result in the exact same 301 response being returned to the browser.


11:59 pm on Dec 11, 2011 (gmt 0)

5+ Year Member

I agree with g1smd, although your CMS doesn't allow 301 redirects (quite strange), I suppose you're considering only php redirects.

There are 3 level where you can act:
  1. htaccess: I doubt your CMS doesn't allow you to insert 301 redirects here, you can modify your htaccess and redirect all 404, with massive rules or one by one
  2. server-side: I suppose this is what you where saying: the CMS doesn't allow you to modify the php to make 301 redirects. It's quite strange you can't modify your 404 php file. Let's see. you write an url--> php checks --> 404 not found. Well you can insert a query just before the 404. Create a table with your lost url, then with php you can check just before giving a 404: "is the uri one of those listed in the table?" if yes you can redirect to another one (the second url in the table), if not then 404
  3. client-side: on this side you can help them in two ways:
    • javascript, as tedster said you don't have to make js redirects because google may think you're making a doorway page or something like that. I don't know if you can make a delayed script like you will be redirected in 5 seconds.
    • proposing them an url. You can give a 404 error and with php propose them the new page. An error like "sorry this page has moved here [link]". Although this "may not" help you in your SEO efforts it may help your users. We always think about the bots but it's important to give to our users an help to avoid them bounce away.

I hope this could have helped in some ways!

Featured Threads

Hot Threads This Week

Hot Threads This Month