私はthis another questionと非常によく似た問題を抱えていますが、そのスレッドで提供されている解決策は役に立ちませんでした。共有ホスティングのLaravelルートが正しく機能しない
私は以下(ところで、ガイドは、リンクされた質問のone of the answersと非常によく似ています)
は私のルート/ web.phpファイル
あるこの guideを使用して、共有ホスティングサービスへの私のLaravelアプリケーションのデプロイを作りました<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function() {
return view('welcome');
});
Auth::routes();
Route::get('/home', '[email protected]')->name('home');
Route::group(['prefix' => 'law', 'middleware' => ['ability:superadministrator,read-users|create-users']], function() {
Route::get('/search', '[email protected]');
Route::get('/new', ['middleware' => ['permission:create-users'], 'uses' => '[email protected]']);
Route::get('/find', '[email protected]');
Route::get('/edit/{id}', '[email protected]');
//region post
Route::post('/new', ['middleware' => ['permission:create-users'], 'uses' => '[email protected]']);
Route::post('/search', ['middleware' => ['permission:read-users'], 'uses' => '[email protected]']);
/*Route::post('/modify', ['middleware' => ['permission:create-users'], 'uses' => '[email protected]']);*/
//endregion
});
Route::group(['prefix' => 'user', 'middleware' => ['ability:superadministrator,read-users|create-users']], function() {
//..similar to the previous one
});
//some other route groups
問題は、私はウェルカムページとログインページにアクセスできます。認証後、私はホームページに行き、問題が始まります。 (mydomain.net/law/searchのような)私が試している以外のルートは、何らかの無限ループの中で再び私をホームページに残す。ログアウトルートも正常に動作します。
何が奇妙なのは、mydomain.net/blahのような存在しないルートを試してみると、Laravel Frameworkの知識RouteNotFound/"NotFoundHttpException"に行きます。
私はPHPログやブラウザのコンソールでエラーを受け取りません。 javascriptは正常に動作します。
ホストサービスのサポートに連絡して、Apacheにmod_rewriteが有効になっていることを確認してください。
私はそれを約3時間捜していますが、ここで深く掘り下げていますが、何かが問題を理解するのに役立ちました。すべてのヒント?
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
MISC:参照私は「
- PHP 7.1
- Laravel 5.4
- The composer.json以下 は、それがどのような方法で助けた場合.htaccesがファイルでありますmをLaravel AdminLTEで使用すると、サイドバーメニューも正しく動作しません。私はそれが両方の問題を引き起こしている同じ問題だと思う。
- 私の.envファイルには特別なものはありませんが、here is (part of) itです。
にREQUEST_URIの内部負荷コンテンツオンになっているだろう
あなたの.htaccessファイルでこれを追加しますか? – ggdxサポート担当者によると、はい、しかし、私は配備する前に、システムの私の見解から確認することはできません – James
'composer dump-autoload'? – ggdx