Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 如何使我的FuelPHP应用程序在子目录中工作?_Apache_.htaccess_Fuelphp - Fatal编程技术网

Apache 如何使我的FuelPHP应用程序在子目录中工作?

Apache 如何使我的FuelPHP应用程序在子目录中工作?,apache,.htaccess,fuelphp,Apache,.htaccess,Fuelphp,我有一个FuelPHP应用程序,我正试图设置它来扩展现有的网站(我们称之为example.com)。FuelPHP安装在DocumentRoot中名为listings的目录中。但是,应用程序的主index.php文件位于名为public的listings子目录中,因此index.php文件的实际路径是/listings/public/index.php。应用程序的静态资产(JavaScript、CSS和图像)也位于public目录的子目录中 我希望人们能够访问/properties上的应用程序。

我有一个FuelPHP应用程序,我正试图设置它来扩展现有的网站(我们称之为
example.com
)。FuelPHP安装在
DocumentRoot
中名为
listings
的目录中。但是,应用程序的主
index.php
文件位于名为
public
listings
子目录中,因此
index.php
文件的实际路径是
/listings/public/index.php
。应用程序的静态资产(JavaScript、CSS和图像)也位于
public
目录的子目录中

我希望人们能够访问
/properties
上的应用程序。此外,还会有对其他页面的请求(如
/properties/admin
)以及对静态资产的请求(如
/properties/assets/css/style.css

我已经让这东西90%工作了。
DocumentRoot
中的
.htaccess
文件如下所示:

RewriteEngine On
RewriteRule ^properties/?(.*)$ /listings/public/index.php/$1 [L]
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]
public
目录中,还有另一个
.htaccess
文件,如下所示:

RewriteEngine On
RewriteRule ^properties/?(.*)$ /listings/public/index.php/$1 [L]
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]
我将FuelPHP配置中的
$base\u url
设置为
http://example.com/properties/
。静态资产的所有URL都以我期望的方式显示,例如,指向我的
bootstrap.css
文件的路径显示为
http://example.com/properties/assets/css/bootstrap.css
。这就是我所期望的。但是,Apache并没有获取静态资产,而是通过FuelPHP
index.php
文件运行请求,结果是404

我想我需要在
DocumentRoot
中的
RewriteCond
文件中添加一个
RewriteCond
,但我不确定这是否正确,或者
RewriteCond
是什么样子


如何调整
.htaccess
文件,以便能够访问静态资产,如
http://indyapm.com/properties/assets/css/bootstrap.css
它实际上位于
/listings/public/assets/css/bootstrap.css

我相信你想要的是一个重写库

RewriteEngine On # after this
RewriteBase /properties/ # insert this

这样,用正确的基本url设置主配置就可以了。

我相信您需要的是一个基本url

RewriteEngine On # after this
RewriteBase /properties/ # insert this
这样,用正确的基本url设置主配置就可以了