I am new to htaccess and was wondering about something.

I just made a subdomain on my webside mainly becouse i want a spesific address to it.

Lets say my website is : http://website.com And my subdomain is http://sub.website.com with its main folder in /home/username/public_html/sub/ When i did this and created an index.php inside the sub folder, and wrote http://sub.website.com in the address bar, the address automaticly changed to http://website.com/sub/ but i wanted it to continue to show http://sub.website.com .

And also im wondering if this is possible without making a subdomain. (This is what i prefer most, i want to have all the main files in the root folder)

Lets say i have a file called sub.php in my root folder. http://website.com/sub.php What i wish to achieve is that when i write http://sub.website.com it would be same as showing the webpage http://website.com/sub.php, and after the webpage has loaded i wish that the address bar still shows http://sub.website.com and does not change to anything else for example something like this : http://website.com/sub/

If this is possible to achieve, would it be possible to achieve rewriting of the form:

http://website.com/sub.php?cat_id=3&photo_id=324

into something like

http://sub.website.com/3/324/

This is really hard for me to achieve, htaccess is hard to understand even after reading tutorials. Would i need to edit the htaccess file in the root folder, or make another htaccess file in the sub folder? If i could achieve this i would be so happy.

Best of regards, Alexander