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 PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何替换eregi() 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
