1

Fuel PHP のインストール手順(大好きです) を何度も読んだ後、URL に public/ を表示せずにアプリを機能させる方法がわかりません。(つまり、すべて自己完結型です)。

私のセットアップはこれです:

/Users/AeroCross/Sites(これは MAMP がすべてのファイルをロードする場所、つまり localhost) /Users/AeroCross/Sites/projects/mariocuba(これは Fuel アプリの webroot です)

含まれるもの:

    mariocuba/
        .htaccess
        oil
        fuel/
            app/
            core/
            packages/
        public/
            .htaccess

フォルダ.htaccess内:mariocuba

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteBase /public

RewriteRule ^(/)?$ index.php/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

publicフォルダー内の .htaccess :

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L]

アプリ (/Users/AeroCross/Sites/projects/mariocuba/) を読み込もうとすると、次のエラーが表示されます。

Not found.
The requested URL /public/index.php/ was not found on this server.

ここで何をすべきかわかりません。

そのように動作するように設計されていないことはわかっていますし、安全でないこともわかっていますが、これは開発とバージョン管理を目的としています。これを機能させるには、(ファイル システムの微調整を最小限にして) どうすればよいでしょうか?

config.phpファイルを と で構成しbase_url = nullていることは注目に値しますindex_file = null

どんな助けでも大歓迎です!

4

3 に答える 3

2

既存の .htaccess ファイルを /mariocuba から削除し、/mariocuba/public の内容 (.htaccess を含む) を /mariocuba に移動してから、index.php を編集します。

変化する:

/**
 * Path to the application directory.
 */
define('APPPATH', realpath(__DIR__.'/../fuel/app/').DIRECTORY_SEPARATOR);

/**
 * Path to the default packages directory.
 */
define('PKGPATH', realpath(__DIR__.'/../fuel/packages/').DIRECTORY_SEPARATOR);

/**
 * The path to the framework core.
 */
define('COREPATH', realpath(__DIR__.'/../fuel/core/').DIRECTORY_SEPARATOR);

に:

/**
 * Path to the application directory.
 */
define('APPPATH', realpath(__DIR__.'/fuel/app/').DIRECTORY_SEPARATOR);

/**
 * Path to the default packages directory.
 */
define('PKGPATH', realpath(__DIR__.'/fuel/packages/').DIRECTORY_SEPARATOR);

/**
 * The path to the framework core.
 */
define('COREPATH', realpath(__DIR__.'/fuel/core/').DIRECTORY_SEPARATOR);

これについては、こちらのインストール手順で詳しく説明しています: http://docs.fuelphp.com/installation/instructions.html#/manual

于 2012-08-15T15:53:55.783 に答える
1

ルートディレクトリに.htaccessファイルを追加し、次の書き換えルールを使用します。

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteBase /YOUR_LOCAL_PROJECT_FOLDER/public

    RewriteRule ^(/)?$ index.php/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

注: .htaccessをホストにアップロードしたら、編集する必要があります(動的に計算できないため)。

于 2012-08-16T18:29:27.167 に答える
0

public フォルダーの下にあるものをすべて非表示にしたい場合 (私がよく行うこと)、これをルートにあるものとして使用します。

RewriteEngine on
RewriteRule ^(.*) public/$1 [L]

これにより、すべてのリソースもパブリックにリダイレクトされます。したがって、公開されていないものはすべて完全に安全です。

于 2012-08-14T15:49:09.580 に答える