当点击显示请求的URL/文件名的链接时,在该服务器上找不到php
有一个php项目是用核心php开发的。现在我的工作是更改一些样式表问题。所以我只是下载了数据库中的所有文件。之后,我在本地主机(LAMP)上进行了所有设置。然后我刚刚浏览了网页,我看到主页显示正确。但是当我点击任何一个链接时,我得到了一个错误,比如当点击显示请求的URL/文件名的链接时,在该服务器上找不到php,php,.htaccess,Php,.htaccess,有一个php项目是用核心php开发的。现在我的工作是更改一些样式表问题。所以我只是下载了数据库中的所有文件。之后,我在本地主机(LAMP)上进行了所有设置。然后我刚刚浏览了网页,我看到主页显示正确。但是当我点击任何一个链接时,我得到了一个错误,比如 Not Found The requested URL /filename.php was not found on this server. Apache/2.2.22 (Ubuntu) Server at localhost Port 80
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
#suPHP_ConfigPath/home/demosite/public_html
php_值session.use_trans_sid 0
php_值session.cookie_时间3600
php_value session.gc_maxlifetime 3600
#php_value session.cookie_domain“.demosite.com”
重新启动发动机
重写规则^([a-zA-Z0-9\+-]+)\.html$1.php
#重写规则404\.shtml$404.php
选项+符号链接所有者匹配
重写基/
重写cond%{HTTP_HOST}。
重写cond%{HTTP_HOST}^www\。[北卡罗来纳州]
重写cond%{HTTP\u HOST}%{REQUEST\u URI}^([A-Za-z0-9]+)\.demosite\.com/([^/]*)
重写秒%1%3^(.*)\1$[NC]
重写规则^(.*)-[E=用户:%1]
重写cond%{REQUEST_FILENAME}-F
重写cond%{HTTP_HOST}^www\。
重写cond%{HTTP_HOST}^demosite\.com
重写条件%{ENV:USER}^(+)$
重写规则^(.*)公司索引.php?uid=%1
重写cond%{HTTP\u HOST}^www\([A-Za-z0-9]+)\.demosite\.com
重写规则^(.*)公司索引.php?uid=%1
重写规则类别\/([a-zA-Z0-9\+-]+)\.html browsecats.php?浏览=1美元
重写规则类别\/([a-zA-Z0-9+]+)\/([0-9]+)\/([a-zA-Z0-9+]+)\。html browsecats.php?浏览=$1和cid=$2
重写规则列表\/([a-zA-Z0-9\+-]+)\.html listings.php?浏览=$1
重写规则列表\/([a-zA-Z0-9\+-]+)\/([0-9]+)\.html listings.php?浏览=$1&pg=$2
重写规则列表\/([a-zA-Z0-9+]+)\/([0-9]+)\/([a-zA-Z0-9+]+)\.html listings.php?浏览=$1&cid=$2
重写规则列表\/([a-zA-Z0-9+]+)\/([0-9]+)\/([a-zA-Z0-9+])\/([0-9]+)\.html listings.php?浏览=$1&cid=$2&pg=$4
重写规则^([a-zA-Z0-9+-]+)\.htm$$1.html
此处demosite是站点名称。我已经替换了您添加的标签。htaccess to your tags我假设您正在使用它 如果它有
RewriteBase/
,但您的项目位于子目录中,请确保该子目录已添加到该子目录中,否则rewrite将在错误的目录中查找该文件
因此,请添加您的:
RewriteBase /path_to_the_project_folder
项目文件夹的路径是什么?,
/filename.php
意味着http://localhost/filename.php
to the project folder/指www folder中的项目目录中的文件夹和子文件夹。感谢您的回复。假设我的项目位于/var/www/projects这样的文件夹中规则是什么?RewriteBase/projects
如果它位于项目的子目录中,比如/var/www/projects/work1
,那么RewriteBase/projects/work1