[英]laravel publish site issue
I need to publish my web app written in laravel 4, i've followed many tutorial in internet but i'm not able to make it works correctly. 我需要发布用laravel 4编写的Web应用程序,我已经在互联网上关注了许多教程,但是我无法使其正常运行。
i'm on a dedicate server with centos 6.6 where resides another website so the laravel app should be placed in a sub folder named vols
我在带有centos 6.6的专用服务器上,该服务器驻留在另一个网站上,因此laravel应用应放置在名为
vols
的子文件夹中
this is the current folder structure: 这是当前的文件夹结构:
/
var/
www/
laravel/
app/
bootstrap/
vendor/
...
html/
vols/
other files of my website
i've changed the paths inside bootstrap/paths.php
to 我已经将
bootstrap/paths.php
的路径更改为
'app' => __DIR__.'/../../laravel/app'
'public' => __DIR__.'/../../html/vols'
'base' => __DIR__.'/../../laravel'
'storage' => __DIR__.'/../../laravel/app/storage'
and the paths inside vols/index.php
to 以及
vols/index.php
内的路径
require __DIR__.'/../../laravel/bootstrap/autoload.php';
$app = require_once __DIR__.'/../../laravel/bootstrap/start.php';
my first controller is named volunteers
, so if visit http://mydomain/vols
i should be redirected to http://mydomain/vols/volunteers
instead i see this error message: The requested URL /vols/volunteers was not found on this server.
我的第一个控制器名为
volunteers
,因此,如果访问http://mydomain/vols
我应该重定向到http://mydomain/vols/volunteers
而我看到此错误消息: The requested URL /vols/volunteers was not found on this server.
if i try to connect to http://mydomain/vols/index.php/volunteers
everything works correctly but i don't want index.php in my route. 如果我尝试连接到
http://mydomain/vols/index.php/volunteers
一切正常,但我不希望index.php在我的路线中。
i think i should work on .htaccess
inside vols
folder, but i've never studied how it really works, so i'm just copying some random snippets from internet substituting public
with vols
. 我认为我应该在
vols
文件夹中的.htaccess
工作,但是我从未研究过它的真正工作原理,所以我只是从Internet上替换一些用vols
代替public
随机摘要。
currently it look like this 目前看起来像这样
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^vols
RewriteRule ^(.*)$ vols/$1 [L]
</IfModule>
Some solutions suggests to create vhost, technically i can do that, but i don't know how. 一些解决方案建议创建虚拟主机,从技术上讲,我可以做到这一点,但是我不知道该怎么做。
Could you please help me? 请你帮助我好吗?
You should place the following .htaccess in your vols folder - 您应将以下.htaccess放在vols文件夹中-
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /vols/
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.