Local host leading to a default file on pc

I have wampserver installed on my local pc. But when I want to test my php files using my localhost, I am always led to one of the php files I have created. It is as if I had set it to act as a default file to be opened whenever I connect to localhost. Due to this I am unable to test any of my files on my locahost. Instead, I am now using a subdomain on my host’s server to create files for testing.

Why is this happening? How do I change it so that whenever I connect to local host, I can see all the php files that I have saved locally on my pc instead of one particular file which is acting as a default file?

It sounds like you have an index.* or default.* file that is loading when you go to your localhost root (which is the default action).

To fix this, go where you store your files and delete/rename any files that are named index or default and this should fix the problem.

Thanks a lot, samanime. I had indeed named the said file as index and that was causing the problem. As soon as I changed the name of the file, I am now able to view all the files in my localhost.