You would need an IP based site to do this.
The htaccess can be created within public_html/.htaccess , simply place the file there and it should work.
On the contrary, the account
DOES NOT need to have it's own dedicated IP (
IP based account) but the virtualhost and DNS do need to be setup to operate with a wildcard. Setting up fancy re-writes won't be of much use if Apache does not know to accept the site handling for the subdomain in the first place!
Something like this in /usr/local/apache/conf/httpd.conf:
Code:
ServerName [url=http://forums.cpanel.net]mydomain.com[/url]
ServerAlias [url=http://forums.cpanel.net]www.mydomain.com *.mydomain.com[/url]
And in your DNS zone file in /var/named/mydomain.com.db:
(
Obviously mydomain.com would be replaced with your own domain and 1.1.1.1 would be replaced by the IP being used on the account irregardless whether it is using the server shared IP or it's own IP)
Don't forget that you would want to restart both Apache and DNS servers after making these updates and you will also need to run the Cpanel Apache distiller script so that your changes are not automatically deleted later.
As for .htaccess, you can use rewrites to detect what HTTP_HOST has been used to connect and parse off different content depending on the URL used to connect or in the reverse rewrite folder addresses to neater looking subdomains. You can also do this through script as well in the index but neither will work unless you have wildcard DNS and wildcard host setup for the account.