Php Laravel routes不参与生产
我有一个Laravel5/angularJS应用程序(Being Laravel作为api rest,前端为angularJS) 在我当地的环境中,一切都很有魅力 但当我上传到主机时,我只能访问索引页面,其他所有内容都会抛出404 在我的共享主机中,我有这样的文件系统Php Laravel routes不参与生产,php,angularjs,.htaccess,laravel,shared-hosting,Php,Angularjs,.htaccess,Laravel,Shared Hosting,我有一个Laravel5/angularJS应用程序(Being Laravel作为api rest,前端为angularJS) 在我当地的环境中,一切都很有魅力 但当我上传到主机时,我只能访问索引页面,其他所有内容都会抛出404 在我的共享主机中,我有这样的文件系统 public_html laravel-backend (it has app, bootstrap, confi...etc, all laravel app) laravel-frontend (it woul
public_html
laravel-backend (it has app, bootstrap, confi...etc, all laravel app)
laravel-frontend (it would be like the public folder of the laravel default file system)
.htaccess
.htaccess内容:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} anotherAppDomainAtSharedServer$ [NC]
RewriteCond %{REQUEST_URI} !/.*$
RewriteRule ^(.*)$ /$1 [L]
RewriteCond %{HTTP_HOST} laravelAppDomain$ [NC]
RewriteCond %{REQUEST_URI} !^/laravel-frontend/.*$
RewriteRule ^(.*)$ /laravel-frontend/$1 [L]
</IfModule>
还有routes.php
Route::get('/', function () {
return view('index');
});
Route::group(['prefix' => 'api/v1'], function(){
Route::resource('authenticate', 'AuthenticateController', ['only' => ['index']]);
Route::post('authenticate', 'AuthenticateController@authenticate');
....
所以,正如我所说,我可以看到登录页面,但当我想登录时,我得到404错误
http://laravelAppDomain/laravel-backend/api/v1/authenticate 404 (Not Found)
NotFoundHttpException in RouteCollection.php line 161:
有线索吗?我错过了什么配置
此外,我没有访问configuration server的权限,我想我不能像在本地环境中那样编辑etc文件夹主机、vHost或类似内容。假设您在Unix上的apache2服务器上:
- 运行命令
sudo a2enmod rewrite
- 确保您的
中有如下部分。请注意,/etc/apache2/sites available/000 default.conf
是apache2的默认根目录,您的可能是/var/www/html
或类似的内容/var/www/html/public
允许超越所有
- 运行
sudo服务apache2重新启动
- 看看这是否有效
public_html
laravel-app
public
斯坦达尔·拉韦尔路
然后我配置指向公共的.htaccess,请求开始工作。我看不到这些文件,我只能访问公共html文件夹。我非常确定其他步骤是必要的,但您是否尝试运行
a2enmod
命令并重新启动服务器以检查是否已修复?我没有ssh访问,我只能通过c-panel进入,所以我不能运行任何控制台命令。很抱歉,我不知道如何帮助您。无论如何,我知道您的观点,这正是我在本地环境中所做的,但是在这个服务器上,我被束缚住了,但是在web服务器的可公开查看的目录结构中提供完整的laravel应用程序是个坏主意。请参阅本文中的一些建议。。。()
public_html
laravel-app
public