不要将文件夹中的php文件显示为主目录

My files are in a folder named Project

link looks like this http://sitename.com/project/news.php

How can I show you like home directory link looks like this (without deleting the project folder or not move) http://sitename.com/news.php Source /project/news.php

If you have mod_rewrite enabled on your server and are using apache

make a file called .htaccess on the root

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^project(/.*|)$ $1 [L,NC]  
</IfModule>

You can use a mod_rewrite creating an .htaccess file in your root directory:

RewriteEngine On
RewriteRule ^(.*)$ project/$1 [L]

Regarding the listing on page, you can easy replace the string as you like:

$files = scandir('/path_to_your_project-folder');
foreach($files as $file) {
    echo 'http://sitename.com/' . $file; //clicking on this link the htaccess rule show the right page wrapping the real url
}

Hope is helpful for you.