PHP codeigniter と chriskacerguis/codeigniter-restserver を使用しています。
私のディレクトリ構造は以下の通りです
├───cache
├───config
├───controllers <-- api.php
│ └───api
├───core
├───helpers
├───hooks
├───language
│ ├───bulgarian
│ ├───english
│ └───portuguese-brazilian
├───libraries
├───logs
├───models
├───third_party
└───views
└───errors
├───cli
└───html
私の .htaccess は以下の通りです
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
<IfModule mod_headers.c>
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
</IfModule>
config.php エントリを編集しました
$config['index_page'] = 'index.php';
私のローカルラップトップでは、すべてが完璧に機能しています。コードをサーバーに移動したところ、機能しませんでした。
たとえば、http://www.example.com/pal/api/class/
-geting 404のような URL にアクセスします。
一方、ローカルで行う場合:http://localhost:88/pal/api/class/
出力JSONを返します
サーバー(ローカルではなく)のログファイルで、URLが実際に次のようにレンダリングされていることに気付きましたhttp://www.example.com/pal/api/class/index
URL の最後の /index が問題を引き起こしていると想定しています。
誰でもこれを修正する方法を提案できますか? サーバーに移動する前に、コード内のすべてのハードコード「localhost」をスキャンしてクリアしました...
**my **routes.php** is as below**
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;