I really need your help because I can not solve this problem.
I want to use htaccess to achieve the following functions:
Access http://xxxx.domain.com or http://xxxx.domain.com/, the url will be redirected to: /website.php?subdomain=xxxx, and the "xxxx" can not contain certain strings such as www, admin, email and so on.
Access http://xxxx.domain.com/category89.html, the url will be redirected to: /category.php?subdomain=xxxx&cid=89
Access http://xxxx.domain.com/document1234.html, the url will be redirected to: /document.php?subdomain=xxxx&did=1234

I tried the following rules, but only achieved the first step, the second and third steps have failed, please help me.

RewriteCond %{HTTP_HOST} (?!www|shop|bbs|home|pay|account|admin|cms|image|mobile|m|wap)^[a-z0-9\-]+\.domain\.com$
RewriteRule ^/?$ /%{HTTP_HOST}
RewriteRule ^/([a-z0-9\-]+)\.domain\.com/?$ /website.php?subdomain=$1

thank you very much