How to server wordpress from SSL and non-SSL URLs

I’m using a plugin for this called WordPress HTTPS. If you still intend to code a solution yourself, maybe you can get some ideas from it at least.

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