301 redirect from old URL structur to new

You can make a catch on 404 in wordpress with filter 404_template

Or you can use redirection plugin: http://wordpress.org/plugins/redirection/screenshots/ with Regex.

Can you follow the link in this Question: Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)