继承的 PHP 站点找不到资产


Inherited PHP site not finding assets

我从另一个开发人员那里继承了一个PHP站点,但无法弄清楚出了什么问题。我怀疑某处有某种重写规则,但我不确定在哪里查找(或具体要查找什么......

我已经安装了 MAMP,它工作正常。我在 MAMP 目录中运行了几个站点,没有问题。

当我把这个网站放进去并尝试运行页面时,我得到的页面没有CSS,JavaSCript或图像。当我"右键单击"图像并在新选项卡中打开它时,找不到图像,因为浏览器尝试在目录中向上一级到 MAMP 目录,而不是在站点根目录中查找。

在指向其他页面的链接上也是如此,它们都尝试进入MAMP htdocs目录。

例如,在htdocs中,我有我的网站的根文件夹,索引页面为:"htdocs/mysite.com/index.php"

页面上是指向另一个页面的链接<li class="nav_company"><a href="/company/index.php" title="Company">Company</a>

单击"公司"会导致浏览器转到htdocs文件夹并查找"/company/index.php",这当然不存在。

我去哪里寻找罪魁祸首?是否有我可以在站点文件中搜索的术语或内容?我正在使用 dreamweaver 和冷利用查找和替换工具,如果我只是知道要去寻找什么......

编辑 这是网站根文件夹中的(净化的).htaccess 文件

Options +FollowSymLinks 
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sitename'.com
RewriteRule (.*) http://www.sitename.com/$1 [R=301,L] 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}' /([^/]+/)*index'.html' HTTP/ 
RewriteRule ^(([^/]+/)*)index'.html$ http://www.sitename.com/$1 [R=301,L] 
Redirect 301 /products/ http://www.sitename.com/plastic-handles/
Redirect 301 /plastic/index.html http://www.sitename.com/plastic/plastic.html
Redirect 301 /applicator/index.html http://www.sitename.com/applicator/applicators.html
Redirect 301 /company/index.html http://www.sitename.com/company/about-us.html
Redirect 301 /contact/index.html http://www.sitename.com/contact/contact-us.html
Redirect 301 /news/index.html http://www.sitename.com/news/news.html
Redirect 301 /trade/index.html http://www.sitename.com/trade/tradeshows.html

提前谢谢。

看起来您的资产和链接都指向根,因此/contact/index.php 将查看http://localhost/contact/index.php而不是http://localhost/mysite.com/contact/index.php

考虑设置虚拟主机以指向新的站点目录。

否则,将所有链接和资产更改为完整 URL 的情况,例如 http://localhost/mysite.com/contact/index.php

希望这有帮助

编辑:这是设置虚拟主机 http://sawmac.com/mamp/virtual/的指南

编辑

2:作为对您的编辑的回应,.htaccess不会产生影响,因为当您单击链接或服务器查找它将在htdocs/中查找的资产时。它不会走得更远,因此不会到达您的 .htaccess。