My Host Spec. LAMP set-up and cPanel for Admin my sites


Hello all,

Before I begin I would like to say this is a great forum and an excellent resource, okay, onto my question:

I am running numerous website from a single hosting account using multiple domain names and sub-domain's this is all well and good most of the site(s) function correctly I have a couple of hundred visitors per month so I am not exactly hammering this server also I am well within my Bandwidth allowances per month.

Anyway, My Web hosting Server is a typical LAMP set-up running cPanel and I am having some issues with the way that cPanel writes the rules to the .htaccess files and the way that I write the rules into them otherwise cPanel will ignore my settings.

Nether the less I still need to accomplish a few tasks which at present I am reading through the Docs for mod_rewrite via the Apache website.

My first question that I really need answered is this:

- As I am running several sub-domain's and seperate websites from one hosting account (on separate domain names and in separated folders etc) can I have One .htaccess file for each sub-domain 'OR' is the .htaccess file found in '/public_html/' and '/www/' the only File I can write my rules to and manipulate the rest of the domains and sub-domains?

Alternatively can I do both? (the exact opposite of what I just said) keep all my mod_rewrite rules "under one roof" sort of speak and just use the mod_rewrite directive to specify where I want the rules to be applyed to like:
Code:
## EXAMPLE HTACCESS FILE ####

## Put in by my Administrator (I cannot delete it)
Action application/x-httpd-php5 /cgi-bin/php.cgi

RewriteEngine ON

RewriteBase /

<Files .htaccess>
  order allow,deny
  deny from all
</Files>

ErrorDocument 400 /error400.shtml
ErrorDocument 401 /error401.shtml
ErrorDocument 403 /error403.shtml
ErrorDocument 404 /error404.shtml
ErrorDocument 500 /error500.shtml

##  and again further down the htaccess file have some more setting but this time have them aimed at another location /domain or sub-domain (If you get what I mean)?

RewriteBase /example-domain/

ErrorDocument 400 /example-domain/error400.shtml
ErrorDocument 401 /example-domain/error401.shtml
ErrorDocument 403 /example-domain/error403.shtml
ErrorDocument 404 /example-domain/error404.shtml
ErrorDocument 500 /example-domain/error500.shtml

#
##
### EOF EXAMPLE HTACCESS FILE ###

My Second question that I also would like help in getting answered is as follows:

- For the actual structure and mapping of my whole domain name-space URL's -> To Sub-Domains, etc do I put all of them in the root folder .htaccess file or can I specify this information in another folder besides '/ROOT/' as long as I specify the "RewriteBase" line in my .Htaccess file(s) to match-up with the correct .htaccess file: e.g.



Code:
## I thought that RewriteBase / was only allowed to contain a forward slash like the example below.)

RewriteEngine ON

RewriteBase /example-domain

## Domain Mapping rewrite condition rules

RewriteCond %{HTTP_HOST} ^www.domain-name.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^domain-name.co.uk$
RewriteRule ^index.php$ http://www.domain-name.com/support/ [R=301,L] 

#
##
### END EXAMPLE 2 HTACCESS FILE ###


Finally, can you please point me to any Websites for "Mod_ReWrite", other module and directives for Apache Server please. or resources that can make my URL's look like sexy web 2.0 urls e.g
____________________________________________

PHP Code:

<?php
    
echo "Username: ".$_GET['user']."<br />";
    echo 
"Section: ".$_GET['section'];
?>
Code:
## THE .HTACCESS FILE FOR ABOVE PHP EXAMPLE ##

RewriteEngine ON
RewriteBase /
RewriteRule user/([A-Za-z0-9]+)/?(inbox|profile|links)?/?$  users.
php?users=$1&section=$2

## Now if I typed in www.domain.co.uk/user/simon/inbox I should see the output

Username: simon
Section: inbox
Many Thanks in Advance,

Maji]{a

P.S. FYI, I would normally ask my webhost support dept. but they are beginning to charge me for support related question; also they are from a foreign company and their emails are hard to understand as they use translation software or whatever.