Laravel 4从URL中删除公共 [英] Laravel 4 removing public from URL

查看:116
本文介绍了Laravel 4从URL中删除公共的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我在Windows上运行xampp。我目前正在尝试熟悉laravel框架。现在,当这些指出。我如何能够直接访问我的laravel应用程序/网站?



示例,




  • 我现在在做的是: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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆