You may have an intolerance to certain foods, try eating smaller portions of rice and pasta as expands in your intestines. Holland & Barrett do something called charcoal capsules which you take 2 capsules daily, they clean out your gut and relieve the bloated feeling. They also do Aloe Vera juice which you can either take neat (one spoonful a day) or add to a drink, It comes in cranberry flavour or original ( I suggest the cranberry flavour), this also helps with bloating.
The reason for your headaches when drinking is probably down to de-hydration, all I can suggest is, for every pint of lager you drink, equal it with a pint of water.
Hope you feel better