With the S&P 500 having hit a new all-time high on Thursday, many investors are thinking about getting back into the stock market. But concerns about whether the market might be poised for a downturn have investors looking for good bargains.

With that in mind, I found five S&P 500 companies that are trading at particularly attractive valuations right now, according to the latest price-to-earnings figures from S&P Capital IQ. Yet before you simply go and buy all five stocks, let's take a closer look to see if they're actually a good value for investors right now.

Apollo Group (APOL), 5.43 P/E
Apollo is the company behind the popular online for-profit giant University of Phoenix. The entire for-profit educational industry has faced difficult times recently, as falling enrollment and rising student-loan default rates among graduates have led to investor concerns as well as inquiries from government entities and other regulatory authorities.

In part because of those enrollment pressures, profits at Apollo are expected to drop by about 25% in fiscal 2013 compared with last year. Yet the real overhang on shares is the threat of more draconian measures from regulators that could endanger the entire business model on which Apollo and its peers operate. If you're willing to take on that risk and believe that for-profit education will survive and recover, then Apollo shares look quite inexpensive.

Western Digital (WDC -0.53%) and Seagate Technology (STX), 6.04 and 4.76 P/Es
The fortunes of these two companies are strongly linked, given their joint history in dominating the hard-disk-drive space. What's sent these stocks downward is the precipitous drop in PC demand, with an accompanying drop in demand for the hard-drives that typically accompany PCs.

Still, the companies have two viable strategies going forward. First, the rise of the cloud-computing Big Data initiative has increased the need for high-volume storage mechanisms, and that could lead to a resurgence in hard-drive demand for purposes that don't need the higher speeds available from alternative media. Second, both companies have looked to hybrid solid-state hard drives to try to combine high-speed features for key elements like faster boot-up speed with the more cost-effective storage capacity available from traditional hard drives. If either of these strategies proves successful, then both Western Digital and Seagate should be able to limit their future earnings declines and even potentially begin to grow again.

CF Industries (CF 0.90%), 6.71 P/E
Fertilizer-maker CF Industries has benefited from favorable conditions in the agricultural market for years now. Combined with benign cost considerations for fertilizer production, CF has reaped the rewards in strong earnings. Unfortunately, rising natural gas prices could start to hamper its profit growth, as the energy source is a major component of the company's production process.

As the ag market starts to revert to more normal conditions, analysts see CF's earnings falling by 7% to 10% annually in 2013 and 2014. Yet as long as earnings hit bottom near their 2014 levels, then the stock would still have a forward multiple of just 8 -- an attractive level even for a cyclical company.

Pitney Bowes (PBI 0.95%), 6.90 P/E
One of the most remarkable things about seeing Pitney Bowes on this list is that its shares have already risen more than 40% this year, recouping a big chunk of its 2012 losses. The company that once dominated the postage-meter business has worked hard to restructure and find a new strategic direction, yet investors have been skeptical of Pitney Bowes' ability to compete well in the enterprise-communications area.

Even with those concerns, investors seem prepared for Pitney Bowes to hit bottom in 2014 from an earnings standpoint after seeing about an 11% drop in earnings per share in 2013. If that proves to be the low point for Pitney's earnings, then a forward P/E of less than 8 would give value investors a reasonable shot at long-term gains.

Bargains worth looking at
Cheap stocks aren't always good stocks, and these companies all have challenges to face. But if you think that they're up to the task, then the low stock prices these companies give you the potential for some lucrative gains over the long haul.