当点击显示请求的URL/文件名的链接时,在该服务器上找不到


php when clicked on the link showing The requested URL /filename was not found on this server

有一个php项目是在corephp中创建的。现在我的工作是更改一些样式表问题。所以我只是下载了数据库中的所有文件。在那之后,我只是在本地主机(LAMP)上进行了所有的设置。然后我刚刚浏览了一下页面,我看到主页显示正确。但当我点击任何一个链接时,我就得到了一个类似的错误

Not Found
The requested URL /filename.php was not found on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80

当我使用tail /var/log/apache2/error.log命令查看错误日志时,检查问题。我刚看到

[error] [client 127.0.0.1] script '/var/www/filename.php' not found or unable to stat, referer: http://localhost/path to the project folder/

有人能告诉我这里出了什么问题吗?任何帮助和建议都将非常可观。谢谢

更新

当我下载该文件时,我的.htaccess文件类似于这个

#suPHP_ConfigPath /home/demosite/public_html
<IfModule mod_php4.c>
php_value session.use_trans_sid 0
php_value session.cookie_time 3600
php_value session.gc_maxlifetime 3600
#php_value session.cookie_domain ".demosite.com"
</IfModule>
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_+-]+)'.html $1.php
#RewriteRule 404'.shtml$ 404.php
Options +SymLinksIfOwnerMatch
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www'. [NC]
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([A-Za-z0-9]+)'.demosite'.com<>/([^/]*) 
RewriteCond %1<>%3 !^(.*)<>'1$ [NC]
RewriteRule   ^(.*)$ - [E=USER:%1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} !^www'. 
RewriteCond %{HTTP_HOST} !^demosite'.com 
RewriteCond %{ENV:USER} ^(.+)$
RewriteRule ^(.*) company_index.php?uid=%1
RewriteCond %{HTTP_HOST} ^www'.([A-Za-z0-9]+)'.demosite'.com 
RewriteRule ^(.*) company_index.php?uid=%1
RewriteRule categories'/([a-zA-Z0-9_+-]+)'.html browsecats.php?browse=$1
RewriteRule categories'/([a-zA-Z0-9_+-]+)'/([0-9]+)'/([a-zA-Z0-9_+-]+)'.html browsecats.php?browse=$1&cid=$2
RewriteRule listings'/([a-zA-Z0-9_+-]+)'.html listings.php?browse=$1
RewriteRule listings'/([a-zA-Z0-9_+-]+)'/([0-9]+)'.html listings.php?browse=$1&pg=$2
RewriteRule listings'/([a-zA-Z0-9_+-]+)'/([0-9]+)'/([a-zA-Z0-9_+-]+)'.html listings.php?browse=$1&cid=$2
RewriteRule listings'/([a-zA-Z0-9_+-]+)'/([0-9]+)'/([a-zA-Z0-9_+-]+)'/([0-9]+)'.html listings.php?browse=$1&cid=$2&pg=$4
RewriteRule ^([a-zA-Z0-9_+-]+)'.htm$ $1.html

这里的demosite是网站名称。我已经替换了

正如您也添加了.htaccess到您的标签,假设您正在使用它,

如果它有RewriteBase /,但您的项目位于子目录中,请确保该子目录已添加到该子目录中。否则重写将在错误的目录中查找文件所以添加您的:

RewriteBase /path_to_the_project_folder