Jump to content

my localhost shows all files in the directory?


sayedsohail

Recommended Posts

Are you talking about this bit of httpd.conf

</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php
</IfModule>

 

paste your files in the root directory, what do u mean by root directory?

Yes it is that bit:

 

DirectoryIndex: index.html index.php index.htm index.php3 index.php5

 

should look something like that.

 

When u access http://localhost, ure actually accessing the root of the server. Example i have my root directory on windows: "c:\wamp\htdocs".

i am on windows aswell, if found document root directing to htdocs and further below doucment root htdocs, you mean i should change this directing to my project directory on both of this places.

 

# DocumentRoot: The directory out of which you will serve your

DocumentRoot "C:/Program Files/Apache2.2/htdocs"

 

and another place it says:

 

# This should be changed to whatever you set DocumentRoot to.

#

<Directory "C:/Program Files/Apache2.2/htdocs">

   

 

 

 

Those two lines must be changed equally. U dont have to change the DocumentRoot to match your project directory, just copy/paste your project to "C:/Program Files/Apache2.2/htdocs". Eventhough in a local environment it isnt important to test have your project in the root. U can paste your project in a directory ex: "C:/Program Files/Apache2.2/htdocs/myproject/" and access it via http with "http://localhost/myproject".

The production environment will be basically the same as your local one. Instead of being in the root ex "var/www/html", ull be in ex "var/username/www/html" where html is your root as a user. Talking about shared ones as in dedicated u can do whatever u want. Copy/paste your project files in the root directory of your account by ftp and access the site by your domain or whatever.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.