nikhil nikhil - 4 months ago 17
PHP Question

Use website on local host

its hard to explain but maybe someone understand

i create four pages of a website named homepage.php,page1.php,page2.php,page3.php .then I download wampdevloper and install it, which creates a folder named webroot on desktop. i move these files in webroot folder. and now when i open local host i can see those four files. and i can open them by clicking on them.works fine.

thats ok but what i want is when i open the local host i want to see homepage.php . and i want page1 file in the directory http://homepage.php/page1 (like a original website). but now these all pages lies in same directory for example localhost/homepage.php,localhost/page1.php and so on. i know its complicated to understand . i cant find any solution . please help.

Answer

localhost is the root of your site. Therefore you use http://localhost. This will open the index.html or index.php contained in the root directory. If you wish to open a certain file you will have to locate it like so: http://localhost/directory-name/file-name.php

However you can't have file-name.php/other-file.php

The URL is made up of the root, the directory path and the file name

localhost/folder-one/folder-two/file-one.php

 ↑          ↑           ↑          ↑
 |                |                |
root        directory path        file
Comments