.htaccess将index.php和资产放在公用文件夹中

时间:2015-07-29 16:10:14

标签: php apache .htaccess codeigniter wamp

我希望我的项目树分为这样:

  • 应用
  • 公共
    • 资产
    • 的index.php
  • 系统

我应该有两个.htaccess个文件(一个在内,另一个在/public内)还是只有一个?

我的项目位于网址http://localhost/my-project/

我已将$system_path$application_path指向其父文件夹,如下所示:

$system_path = '../system';
$application_folder = '../application';

但我可能会遗漏一些东西。

1 个答案:

答案 0 :(得分:0)

您的 root 目录中只需要一个.htaccess文件,其中包含以下条目:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ public/index.php/$1 [L]
相关问题