How to set up Firefox to absolutely never to delete any history items?

Solution 1:

There is now a proper solution (Firefox v40): places.history.expiration.max_pages will override the 'optimal database size' calculations, so setting it to a large positive value should get the desired effect.

See this answer.

Solution 2:

You could run a private Firefox Sync server, and set the History retain size to 1 GB, or something insane like that. As far as I know, it will not delete history, and you'll be able to see that entire history on any browser instance you sync.

Solution 3:

In the palemoon forum from user341084's answer, there was a link to expire-history-by-days add-on - which has an option to disable expiration completely (or define expiration period).

Solution 4:

I had the same issue and I discovered a hacky way which you can read about here: http://forum.palemoon.org/viewtopic.php?t=3260

The tl;dr version is, use mozilla.cfg to lock the variable places.history.expiration.transient_current_max_pages to 2147483647 (the largest value accepted). The issue is that Firefox will change that setting automatically unless you lock it.

Note that mozilla.cfg does not work in Portable Firefox, so in such a situation I recommend using Portable Pale Moon instead (which does work with mozilla.cfg)

You can find info on using mozilla.cfg here: http://kb.mozillazine.org/Locking_preferences

This technically doesn't set it to keep history forever, but it'll retain a heck of a lot of entries. I currently have history going back 18 months now and my places.sqlite file (which retains the history) is over 150 MB (6 months ago it was about 100 MB, so for me I add 50MB every 6 months). Note that, with such large sizes, an SSD is HIGHLY recommended. If you don't have one then consider using a ramdisk + symbolic links instead (a ramdisk that saves data at timed intervals or at shutdown).

Also, it may be a good idea to make backups of your history file in case it borks out or something. Then again, it's a good idea to make entire hard drive backups as well...