サーチ…
前書き
LaravelのURLからpublicを削除するには、インターネット上で多くの回答がありますが、最も簡単な方法は以下のとおりです
どうやってするか?
URLからpublicを削除するには、次の手順に従います
-
.htaccessファイルを/publicディレクトリからLaravel/projectルートフォルダにコピーします。 -
Laravel/projectルートフォルダ内のserver.php名前をindex.phpます。
あなたは元気になるでしょう。
注:これは、 Laravel 4.2 、 Laravel 5.1 、 Laravel 5.2 、 Laravel 5.3でテストされています。
私はこれがURLからpublicを削除する最も簡単な方法だと思う。
URLを一般公開から削除する
-
server.php名前をindex.php変更する -
.htaccessをpublicフォルダからrootフォルダにコピーします。 - 静的に
.htaccessを次のように少し変更する:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]
時には私はpublicフォームのURLを削除するためにこのメソッドを使用しました。
Modified text is an extract of the original Stack Overflow Documentation
ライセンスを受けた CC BY-SA 3.0
所属していない Stack Overflow