I'm a new comer to mod_rewrite and have used an electrical generator however it does not work. It is really an illustration of things i am attempting to achieve.

The initial URL:
http://subdomain.domain.com/company.php?test=TES001

The rewritten URL:
http://subdomain.domain.com/company/AAA001

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule company/(.*)/(.*)/$ /company.php?$1=$2
ErrorDocument 404 /

Any help could be appreciated, thanks.

I believe your RewriteRule is designed in the wrong manner, type of backwards, it ought to be

RewriteRule company.php?test=([A-Z]+)([0-9]+) /company/AAA$2

I.e. you initially provide the pattern to complement after which what it's rewritten to... however I am unsure if you're able to really match the GET parameters such as this...

If you would like /company.php?test=AAA001 to redirect to /company/AAA001, do that:

RewriteCond %{QUERY_STRING} test=([A-Z]+[0-9]+)  
RewriteRule ^company.php /company/%1? [R]    

If you would like /company/AAA001 to become rewritten as /company.php?test=AAA001, do that:

RewriteRule company/([A-Z]+[0-9]+)$ /company.php?test=$1

I am not really a mod_rewrite expert, but:

RewriteRule company/(.*)/(.*)/$ /company.php?$1=$2

should not match expressions like:

/company/foo/bar/

and map them into:

/company.php?foo=bar

You've, inside your URL, just:

/company/foo

Do you know the Apache logs saying? Is the .htaccess really read? Have you reload the Apache configuration? (can't remember if it's needed)

You will find the wrong order... soon after "RewriteRule" is the type of the URL that you would like (ie. your clean url), using the Regex for whatever may change for the reason that url. Next, you will find the path from the URL, as well as the Regex tokens for that found values (ie. $1, $2, etc.)

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

ErrorDocument 400 http://www.domain.com/400
ErrorDocument 403 http://www.domain.com/403
ErrorDocument 404 http://www.domain.com/404
ErrorDocument 500 http://www.domain.com/500

RewriteEngine on
RewriteBase /
#PAGES

RewriteRule ^/company/([A-Z]+)([0-9]+)/$ company.php?test=$1&%{QUERY_STRING} [NC,L]