$url = "https://". $_SERVER['SERVER_NAME'] . ":443".$_SERVER['REQUEST_URI'];
The code came from this blog, and is made for IIS Web Server, but after giving it a try on Centos 5, my Cacti System, it works like a charm and is very easy to deploy.
So here is the tip on how to deploy in your Linux-Cacti Machine:
1. Edit the index.php located on cacti's root folder
copy the PHP code above and insert it on the first line of index.php
2. Exit from vi saving the changes and restart httpd service
#service httpd restart
Open your cacti using http://your-server-ip/cacti, this will redirect you to https://your-server-ip/cacti and ask you to verify and confirm web certificate on the first use. Just proceed and complete the process and you are good to go.
The only one problem is, upon login on your cacti and pointing the browser directly to the webpage content like: http://your-server-ip/cacti/plugins/devices/device.php, it will NOT redirect you to https://your-server-ip/cacti/plugins/devices/device.php, instead, the page will just open as a regular http.
A simple fix would be ......insert the PHP code on "device.php". Do this on your other pages as well.