I sorted out this error as:
- Go to the database tables:
core_website
,core_store
andcore_store_group
- First look for
website_id
attribute in tablecore_website
and delete that website id from this. - Repeat same in tables:
core_store
andcore_store_group
.
You can see your website id number in error page. ie getWebsite('3'). Here '3' is website id number
Above solution works well if you delete Website ID but if you remove stores (not store view because that deleted with store automatically) from under main website then this solution doesn’t work.
For that you need go to table cms_page_store and delete rows related store_views those are deleted.
SQL: DELETE FROM cms_page_store WHERE store_id NOT IN (SELECT store_id FROM core_store)
Explanation:
You can check your store_view ids in admin->system->manage stores. All CMS pages should be assoicated with these id. If there is any extra/other id is in table cms_page_store field 'store_d' then 404 error will display.