标签:add redirect ova lsp index specific info public and
虚拟主机无法将目录绑定到 public 目录上,这时,访问就会变成 url/public/。
怎么解决这个问题呢?
解决的主要方法是将Laravel 放到网站的根目录,之后用 .htacess 文件 重新定向请求到 public文件夹。记得设置可存储属性。这种方式我们鼓励,但是虚拟空间暂时没有办法。详细步骤:1. 将 Laravel 放置到你的站点根目录。2.在站点根目录放置 .htaccess 文件,内容如下:
1
2
3
4
5
|
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_URI} !^ public RewriteRule ^(.*)$ public / $1 [L] </IfModule> |
其实这时间基本就好使了。 我是 在 Laravel 5 下进行的。以下是原文,感觉是在4下。
This solution enables you to drop Laravel into your public folder then use a .htaccess file to redirect requests to the public folder. This solution places your application and core system code into a publicly accessible folder. This is not something that we encourage you to do with any PHP framework.
Step 1. Place Laravel in your document root folder.
Step 2. Place the following .htaccess file in your document root folder.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Step 3. Make sure that you manually set your ‘url’ configuration in application/config/application.php otherwise Laravel will generate incorrect URLs. Make sure that each of your environments have the correct application.url configuration. For more information on environment-specific configurations see: http://laravel.com/docs/install#environments
That’s all.
标签:add redirect ova lsp index specific info public and
原文地址:http://www.cnblogs.com/caicaizi/p/6002743.html