There are many different ways to record your electric guitar in your home studio. In the old days, the only way to record an electric guitar was by placing a microphone in a position where it could pick up the sound of the guitar amp.
Today, many guitar amplifiers have line outputs that will facilitate sending the signal from the amp directly to your recording interface. In fact, you don't even have to have an amplifier at all to record an electric guitar. There are many amp simulators that can digitally reproduce the sound of any number of different type amplifiers - including all the effects you can imagine.
You can also plug your guitar into an interface or a direct box and input a dry signal into your computer and use your DAW to process the dry signal and add effects such as reverb, distortion, delay, and many others using your software.
But what all of this new fangled digital amp simulation software is trying to do is emulate the sound that the old vintage amplifiers were capable of producing. So if you own one of the older vintage amplifiers (like one of the amps the simulators attempt to reproduce the sound of) you can achieve some very good results if you position a good microphone in the right spot to capture the sound of the amplifier.
If you do have a really good amplifier and you want to mic it, you should use a good instrument mic like a Shure SM 57 or Sennheiser e906. Attach it to a stand designed for the task at hand and point the mic towards the speaker cone either perpendicular or at an angle. You will get a different sound depending on the angle of the mic and whether it is closer to the center of the speaker cone or the edge. You have to try different positions until you get the sound you like best.
Most folks making a low budget home studio type recording are able to get more than satisfactory results with a direct input of the guitar through some type of simulator or effects module that can connect to their computer.
If you have an old vintage tube amplifier and want to capture the authentic sound, and you have a good quality instrument mic, feel free to experiment with miking the cabinet.