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

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

问题描述

所以,我在 Windows 上运行 xampp.我目前正在尝试熟悉 laravel 框架.现在,当那被指出时.我怎样才能直接在根目录中访问我的 laravel 应用程序/网站?

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?

例子,

  • 我现在正在做的是:localhost/laravel/public/about(查看关于页面)
  • 我要做的是:localhost/laravel/about

有什么好的解决方案吗?我需要在 laravel 的根文件夹中添加一个 .htacess 文件吗?(不是公开的).

Any good solutions for this? do i need to add a .htacess file on the root folder of laravel? (not the public one).

有什么建议吗?

推荐答案

最简单的方法是在你的 Laravel 根目录中创建 .htaccess 文件,内容如下:

Easiest way is create .htaccess file in your Laravel root with following content:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

它应该很容易重定向.

参考: https://coderwall.com/p/erbaig/laravel-s-htaccess-to-remove-public-from-url

这篇关于Laravel 4 从 URL 中删除公共的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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