amazon link update requirement...
Amazon changed their servers, requiring an update of amazon ads through several domains and nearly 18,000 html pages.
As part of our continuing effort to improve the Associates program's products and services,
we are making some changes to our technology platform. This platform change will require you
to replace some older product links, banners, and widgets you currently have hosted on your website
as they will no longer be supported after July 31, 2015. Text links are not impacted by this deprecation.
Action Required
We ask that you replace or update the impacted ad units prior to July 31, 2015. The links require the
following update that can be facilitated through your CMS (content management system). You may make these
replacements at whatever scale you are comfortable with.
- Find and replace ws.##FIX## with ws-na.## inactive ##
- Find and replace rcm.##FIX## with rcm-na.## inactive ##
So, I tested a few commands to find those strings... then come up with the one line perl command to find and replace in line...
but then I had to go through seven domains and nearly 18,000 pages... so I decided to use find and xargs. The following sequence
of commands updated the pages. I wonder how long would it have taken to use a GUI tool to edit all of the pages on a server?
Or to ftp the html pages to a PC and edit and then ftp them back. Using vi and the command line tools managing a website isn't
hard. I suppose with a MySQL database a SQL statement could have been generated to update web pages. I have one domain with
WordPress configured, I will try that some day and see... but for now... two commands updated the server.
quick test to scope the 1st name change:
find . -type f -name '*.html' | xargs grep rcm.##FIX##
many files
the command to replace the 1st server names:
find . -type f -name '*.html' | xargs perl -pi -e 's$//rcm.##FIX##$//rcm-na.## inactive ##$g'
|
quick test to scope the 2nd name change:
find . -type f -name '*.html' | xargs grep ws.##FIX##
many files
the command to replace the 2nd server names:
find . -type f -name '*.html' | xargs perl -pi -e 's$//ws.##FIX##$//ws-na.## inactive ##$g'
|
the command could have been executed without xargs as follows:
find . -type f -name '*.html' -exec perl -pi -e 's$//ws.##FIX##$//ws-na.## inactive ##$g' {} \;
Note: always test commands like this at the bottom of a subdirectory in case you have a syntax error so you don't
wipe out your website and learn about the wayback machine like I did... or if you have a backup system how to do restores.
I no longer advertise or sell amazon products on my domains - amsoil and my books are the only thing you'll find.
|