If the Addon domains do not point to the (main domains) public_html folder, or a subdirectory of the
public_html folder then you will need to create a separate
.htaccess in the document root for each Addon domain, since they are completely separate entities. The above directives would then work for the Addon domains
However, if the Addon domains point to subdirectories off the main domain's document root (a common default in cPanel's setup). eg.
public_html/www.example2.com/. Then the above (single)
.htaccess file in the
public_html folder would still work...
UNLESS you already have additional
.htaccess files (that also use mod_rewrite) in the Addon domain's document root directories. This is because mod_rewrite directives are not inherited by default. Now, depending on your config, you could enable mod_rewrite inheritance (but stress that that doesthis would depend on your config and what other directives you already have). Otherwise, you will need to duplicate these directives in the
.htaccess file for each Addon domain - the same as above (as if your Addon domains were in different parts of the filesystem).