I have just converted a website to WordPress. The old site has hundreds of hard-coded html files, and the new site does not match the old site's directory structure or file naming system (bad SEO in the original site), so I can't place any "blanket" 301 redirects. Its been at least 2 months, and the old links are still appearing in Google searches, despite a google-friendly sitemap.xml.

Do I need to hardcode a 301 for every individual page in my htaccess file, or am I just misunderstanding 301s and apache? Is there some other way I can update Google about the fact that my entire site structure has changed?

5 Answers 5


Based on the information you provided I'd say it doesn't look like there is an easy way for you to easily do a bulk 301 redirect, either programmatically or with a blanket .htaccess rule. It looks like you will need to manually do one for each page you migrated over to the new site.

Each page will need it's own 301 as you will want to make sure every link for each page is properly redirected to its new page. Otherwise every page on your new site will be considered new and start from scratch with PR, etc. If you had a lot of incoming links it may be a hassle to do but is very well worth it.


Google search with the string site:mysite.com to get a full dump of all the URLs that are indexed, or go ahead and use Google's Webmaster's Tools and get a list of 404's from them. Then, yes, you will need to manually construct a 301 redirect list.

You can import a file into WordPress › Redirection « WordPress Plugins to generate redirections and log them, too.

  • Site:mysite.com on Google is extremely unreliable. Instead, use Yahoo! Site Explorer. The only Yahoo product worth using. Dec 6, 2010 at 14:56
  • I'm not talking about Yahoo and the question isn't about Yahoo; it's about Google indexing. Dec 6, 2010 at 15:35
  • I know, but site:mysite.com does NOT show all the pages google has indexed. By using Yahoo site explorer you get a way more reliable idea of which pages have been crawled and indexed in general. Only setting up redirects for the pages in site: on Google is a ticket to missing out on a lot of redirects. Dec 6, 2010 at 16:12
  • You're confusing the URLs that happen to be indexed by different search indexes with how 301 .htaccess redirects or plugin-administered redirects work. Any 301 redirect will work for all web traffic, not just selected traffic from one search index or search results. Makes absolutely no difference what search index the URLs are in; 301 redirects will handle them at the site level. Dec 6, 2010 at 19:03
  • I believe the WordPress "Redirection" plugin will (or can be configured to) only redirect when the request will otherwise trigger a 404 - this is important and far preferable to using .htaccess for this - as it prioritises normal site traffic.
    – MrWhite
    May 6, 2019 at 14:35

I suggest you another plugin for wordpress, that i use on two sites administered by me, EggPlants 301 redirects. This plugin don't fill the .htaccess file with new rules, but use the internal routing system of wordpress. With this you can import the redirect rules by a cvs file, getted from the google webmaster tool and editet to include the new path.

  • Providing this plugin is able to redirect only when the request would otherwise trigger a 404 then this is far preferable than using .htaccess for this - as it won't impact normal site traffic.
    – MrWhite
    May 6, 2019 at 14:38

If there are any patterns at all to the redirects then you can cut down on the number of redirects in the htaccess file.

Failing that, you could instead rewrite all the *.html files to a PHP script that reads the redirects from a file or database, for example. You'd still need to manually input everything into said file or database, but you would cut down the size of the htaccess.

  • Ooo, I hadn't even considered the size of the htaccess file -- is that a big issue? Dec 6, 2010 at 15:39
  • It can be a bit of a performance hit if you have over 100 (at a guess) separate rules, because the server has to check each one every time a URL is requested. If you are able to move them to Apache's httpd.conf (unlikely if you don't have a dedicated server) then that will make a big improvement. Otherwise, directing to another script would probably be the best. Dec 6, 2010 at 17:19

I'd say look for some pattern you can use to get close, for example match the title tags, or if the directory structure includes a category IE example.com/category/product.html then set patter to redirect all URLs with "category" to the new category page. It's certainly not as good as redirecting them to the appropriate product page, but it's better then just leaving them all as 404s. There's almost always some kind of convention even if it's a poorly thought out one. (Also assuming you still have all the files you can run Xenu Link Sleuth on them to make sure you get all the pages, even if Google has removed them from the index for being a 404, you'll want to redirect them as there may be some links pointing to them).

Good Luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.