Laravel 4从URL中删除公共 [英] Laravel 4 removing public from URL
问题描述
示例,
- 我现在在做的是:localhost / laravel / public / about(查看
关于页面) - 我想要做的是: localhost / laravel / about
这有什么好的解决方案?我需要在laravel的根文件夹中添加一个.htacess文件吗? (不是公共的)。
有什么建议? 最简单的方法是在你的Laravel根目录下创建 .htaccess
文件,内容如下:
< IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(。*)$ public / $ 1 [L]
< / IfModule>
它应该很容易重定向。
参考: https://coderwall.com/p/erbaig/laravel-s-htaccess-to-remove-public-from-url
So, I'm running xampp on Windows. I'm currently trying to get familiar with the laravel framework. Now, when thats pointed out. How can i be able to access my laravel application/website direct within the root?
Example,
- What I'm doing now is: localhost/laravel/public/about (to see the about page)
- What i want to do is: localhost/laravel/about
Any good solutions for this? do i need to add a .htacess file on the root folder of laravel? (not the public one).
Any suggestions?
Easiest way is create .htaccess
file in your Laravel root with following content:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
It should be redirected easily.
Reference: https://coderwall.com/p/erbaig/laravel-s-htaccess-to-remove-public-from-url
这篇关于Laravel 4从URL中删除公共的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!