I updated my wordpress from version 3.0 to 3.4.1. Immediately I noticed some troubles with permalinks related to categories pages, which return a 404 error. I temporarily solved with WCS-Permalinks plugin that catch 404 and return a page with a url like this: sitename/?cat=x.
So I used function add_rewrite_rule() to add a pretty url into htaccess to solve the problem. I used this code: