Only point I am asking this is for the feat weapon specialization. It has a requirement of fighter level 4. So does that mean only fighters are allowed to take the feat, or are archers, armor masters, ... also allowed to because they are based off the base class?
Yes, archetypes count as the original class.
If a character has levels in a certain class, they may choose one (or more!) archetypes. Each archetype causes the character to change some of their class features, but the underlying class is still the same.
According to the PFSRD section on archetypes:
All other class features of the base class that aren't mentioned among the alternate class features remain unchanged and are acquired normally when the character reaches the appropriate level, unless noted otherwise.
So unless the Armor Master or Archer archetypes says "You don't count as a fighter anymore", then it's safe to assume that the character still counts as a fighter. No archetypes contain such language.
Yes, archetype levels count as base levels.
Archetypes are flavourful alternatives to class features. They replace specific features with a more thematic substitute. They do not change your base class. You still use the fighter advancement table for BAB and Saves so are a fighter. Therefore levels in Archer count as fighter levels.
Relevant text on Archetypes
Archetypes are a quick and easy way to specialize characters of a given class, adding fun and flavorful new abilities to already established adventurers.
Archetypes are not classes
Archetypes are a set of alternate class features that apply to a class, and as long as they don't substitute the same feature, multiple archetypes for the same class can be taken.
So, your character is not an Archer instead of a Fighter.
Rather, they are a Fighter (archer), and the feat's prerequisite is about the class that you still do have.
Therefore, no, archetypes do not count as a class (they are a completely different thing), but the fact that a character with one or more archetypes still counts as (I'd say "still is") its "unarchetyped" class means that they qualify for feats that require X levels in that class.