我已经使用Angular和Laravel 5.6创建了单页应用程序,该应用程序在我的机器上运行良好。基本上这两个框架存在不同。接下来,我将它们上传到实时服务器上,并按照此link
上的教程进行操作基本上,在运行 ng-build --prod 之后,我已将所有生成的文件复制到Laravel的公共文件夹中。我还将index.html文件从Angular的dist文件夹移到resources / views文件夹。
接下来,我将我的route / web.php修改如下:
Route::get('/', function () {
View::addExtension('html' , 'php');
return View::make('index');
});
我的htaccess如下所示
DirectoryIndex public/index.php
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
#Redirecting to https
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://test-app.pwebk.com/$1 [R=301,L]
# 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 ^ public/index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
## Fonts cache
ExpiresActive on
配置完所有内容并重新加载浏览器后,我得到一个空白页面,请协助?