0

Instead of working live on my site I've decided to try and work locally and install new version later on my live site.

So I'm working with Codeigniter and have the following struture.

/htdocs/kow(site)/kowmanager(cms)

When I load https:localhost/kow it loads the correct controller however for some reason its not reconizing that kowmanager is a sub directory of kow with its own application folder and it should be loading the default controller that is set in its routes file. When I load https://localhost.com/kow/kowmanager it loads a page that says index of /kow/kowmanager and then a link to the parent directory. Which isn't anything CI related.

Inside the kow directory this is my .htaccess file. Is this the problem?

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteEngine On
RewriteBase /kowmanager
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

I'm using xxamp.

4

3 に答える 3

1

.htaccessを使用してURLからindex.phpを削除していますか?/ htdocs / kowは、CIがインストールされているプロジェクトのベースディレクトリですか?

kowmanagersをcontrollersディレクトリに配置し、呼び出すコントローラーを指定する必要があります。routes.php構成ファイルで指定しない限り、CIがディレクトリからのデフォルトコントローラーの呼び出しをサポートしているかどうかはわかりません。

とにかく、正確な答えが必要な場合は、さらに情報を提供してください。

于 2012-04-28T19:21:59.180 に答える
1

kowmanagerには何があり、なぜ2つの書き換えがあるのですか?あなたのディレクトリ構造が私が想定している通りであるなら、あなたはあなたの.htaccessファイルから2番目のkowmanagerディレクティブを削除するだけでうまくいくかもしれません。

codeigniterはどのフォルダーにありますか?URLを書き直してindex.phpを削除するだけですが、URLをcodeigniterのindex.phpにマッピングしない限り、コントローラーをロードすることはできません。

Apacheには、URL書き換えに関する多くの情報があります。その多くの読書と振る舞いは常にかなり気難しいですが、多分それはあなたを助けるでしょう:

それ以外の場合は、より多くの情報が私たちがあなたを助けるのに役立ちます。PSこれにもapacheのタグを付けます。これが問題の原因であり、apacheについてよく知っている人に質問を表示してもらう可能性が高くなります。

于 2012-04-28T19:38:21.593 に答える
1

マニュアルに記載されているように、アプリケーションごとにindex.php-pageが必要です。

したがって、 index.phpindexManager.phpにコピーし、その中でアプリケーションフォルダーを変更する必要があると思います。

$application_folder = "kowmanager";

書き直しについてはわかりませんが、次のようになっていると思います。

RewriteEngine On
RewriteBase /kowmanager
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ indexManager.php?/$1 [L]

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
于 2012-04-28T19:23:16.357 に答える