Just change permission to
root/wp-content/plugins/all-in-one-event-calendar/cache folder to 777, and everything should be ok.
Seems like inside of wp_posts table is saved information about permalinks under post_name column.
And if you want to change it manually, check this – http://codex.ww.wp.xz.cn/Class_Reference/wpdb#UPDATE_rows
Found a solution.
I just compared if current pages url is or not the same with the get_bloginfo(‘url’).
If not, then header back to get_bloginfo(‘url’).