Javascript – Which is the best method to redirect users from an existing website to an existing WP blog

javascript, mod-rewrite, redirect, wordpress

I have a website with around 500 HTML pages. I have now posted all these HTML pages into my blog as blog posts. I now want to now redirect users from the page to the blog. I could do that using mod_rewrite or JavaScript?

Since Google will re-index these posts, which of the these two methods would be a better option for SEO?

Kindly also suggest any other techniques you know.

Best Solution

Search engines generally don’t interpret JavaScript. You should better do a proper HTTP redirect. And that can be done with either the mod_alias or mod_rewrite. Here’s a simple example that you can use in your .htaccess file:

# mod_aliasRedirectMatch 301 ^/page/(.*) /blog/$1# mod_rewriteRewriteEngine onRewriteRule ^page/(.*) /blog/$1 [L,R=301]

That will redirect requests of the URL path that starts with /page/ to /blog/. So /page/foo/bar.html would be redirected to /blog/foo/bar.html. Also note the 301 for the proper permanent redirect status code.