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

I want to have my project tree divided like this:

  • application
  • public
    • assets
    • index.php
  • system

Should I have two .htaccess files (one inside the root and another inside /public) or just one?

My project is in the URL http://localhost/my-project/

I have already pointed $system_path and $application_path to their parent folder, like this:

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

But I might be missing something.

You need only one .htaccess file on your root directory, with following entry:

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