As a general rule, it’s a good idea to locate your main subject about a third of the way in from one side or the other, or from the top or bottom, or both.
This placement is more aesthetically pleasing than simply placing the main subject in the center, which seems predictable and uninteresting.
Sometimes, a subject may be in the center, but the main center of attention on the subject is a third of the way in.
The rule of thirds is a general guideline. There are exceptions to the rule, however. Different types of subject matter or the purposes of the photographer may require different positioning of the main subject.