A friend decided to get rid of her Associate-O-Matic Amazon Store and use the domain name for a WordPress site. Since there were over 15,000 pages indexed by Google, she wanted to make sure that any visitor to these now non-existent pages were redirected to the main page of the new WordPress site.

Solution was simple… Associate-O-Matic uses .html for its pages within the Amazon Store while WordPress does not, so a simple rewrite rule in the .htaccess will do the trick.

Here is the rule – if you don’t have an .htaccess file, you’ll need to create one with the following contents, then upload it to your WordPress main directory. Don’t forget to replace Google.com with your website address.

Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /

#Rewrite all urls ending with .html so that they point to the main page
RewriteRule ^([^.]+)\.html$ http://www.google.com/ [R=301,L]

What this will do is permanently redirect any request for .html files to your website’s main page. Now, when a visitor visits one of their bookmarked pages from your amazon store they will be immediately redirected to your new WordPress store.