The Morocco international was surplus to requirements at the Eredivisie champions, and will now continue his career in Serie A
The Serie A side were keen to bolster their attacking options ahead of the 2012-13 campaign, and new head coach Vincenzo Montella has now received the new striker he was looking for.
El Hamdaoui was close to joining La Viola in the January transfer window, but the move fell through for financial reasons.
The 27-year-old started his professional career with Excelsior and also played for Tottenham, Derby County, Willem II and AZ before joining Ajax in the summer of 2010.
The Morocco international failed to make an impact at the Amsterdam giants, though, after falling out with head coach Frank de Boer. He last featured in an official game for Ajax on April 24, 2011.