Laravel 4 removing public from URL(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 中删除公共的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Laravel 4 从 URL 中删除公共


基础教程推荐
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- php中的foreach复选框POST 2021-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- php中的PDF导出 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01