After many suggested code (thanks supersuphot) and a lot of research finally I found an answer.
First I added the subdomain * under mydomain.ne.ro, pointed to domain folder/path:
Then I uploaded .htaccess file with the next code:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mydomain.ne.ro
RewriteCond %{HTTP_HOST} ^(.+).mydomain.ne.ro
RewriteRule ^([^/]*)$ http://mydomain.ne.ro/?id=%1 [P,L]
this works too:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mydomain.ne.ro$
RewriteCond %{HTTP_HOST} ^(.*).mydomain.ne.ro$
RewriteRule ^$ /index.php?id=%1 [P,L]
The most important thing is the P instead R at last line, to keep original subdomain. Check this answer to a related question.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…