共有ホストのWordPressサブディレクトリにlaravel 5.5を配備しようとしています。私はGoogleからあまりにも多くの提案を試みたが、私はまだそれを動作させることはできません。常に404エラーを返します。 WordPressは/public_html
の内部に設置されていると私はここに私の.htaccess
ファイルが見えるものだ/public_html/my-laravel-app
にLaravelをインストールする必要があります。共有ホスティングのWordPressにLaravelを展開する
/public_html/.htaccessを
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>
# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>
# disable the server signature
ServerSignature Off
/public_htmlの/私の-laravelアプリ/ .htaccessの
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /my-laravel-app/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /my-laravel-app/public/index.php [L]
</IfModule>
/public_html/my-laravel-app/public/.htaccess
<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>
/public_html/my-laravel-app/public/index.php(のindex.phpの一部)
require __DIR__.'/../bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
ここで、 '.htaccess'ファイルはどこですか? – Maraboc
@dexterb確かに、laravelは剪定されたホスティングに取り組んでいますか?そうなら、サブドメインに行ってください。私はそれがせん断されたホスティングに取り組んでいないと思う。 –