我有一个 FuelPHP 应用程序,我正在尝试设置它来扩展现有网站(我们称之为example.com
)。FuelPHP 安装在一个listings
名为DocumentRoot
. 但是,应用程序的主index.php
文件位于listings
called的子目录中public
,因此文件的实际路径index.php
是<DocumentRoot>/listings/public/index.php
. 应用程序的静态资产(JavaScript、CSS 和图像)也位于目录的子目录中public
。
我希望人们能够在/properties
. 此外,还会有对其他页面的请求(例如/properties/admin
)以及对静态资产的请求(例如/properties/assets/css/style.css
)。
我已经得到了大约 90% 的工作。中的.htaccess
文件DocumentRoot
如下所示:
RewriteEngine On
RewriteRule ^properties/?(.*)$ /listings/public/index.php/$1 [L]
在该public
目录中,还有另一个.htaccess
文件,如下所示:
Options +FollowSymLinks -Indexes
RewriteEngine on
# Send request via index.php (not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
我将$base_url
FuelPHP 配置中的http://example.com/properties/
. 静态资产的所有 URL 都以我期望的方式显示,例如,我的bootstrap.css
文件的路径显示为http://example.com/properties/assets/css/bootstrap.css
. 这是我所期望的。然而,Apache 并没有抓取静态资源,而是通过 FuelPHPindex.php
文件运行请求,导致 404。
我想我需要在RewriteCond
中的.htaccess
文件中添加一个DocumentRoot
,但我不确定这是否正确,或者RewriteCond
会是什么样子。
如何调整我的.htaccess
文件,以便我能够访问静态资产,例如http://indyapm.com/properties/assets/css/bootstrap.css
实际位于的文件<DocumentRoot>/listings/public/assets/css/bootstrap.css
?