laravel隐藏index.php的方法

laravel隐藏index.php的方法,第1张

laravel隐藏index.php的方法

laravel隐藏index.php的方法:1、开启Apache mod_rewrite模块,并修改htaccess文件;2、在Nginx配置文件中通过“try_files $uri $uri/...”指令实现隐藏index.php。

本文 *** 作环境:windows7系统、Laravel5.7版,DELL G3电脑

laravel 配置 隐藏index.php

Apache

首先保证你的Apache mod_rewrite 模块已经开启. 框架默认有一个 public/.htaccess 文件可以实现隐藏 index.php 的访问.

如果无效的话,可以试试下面的规则:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Nginx

在Nginx配置文件中通过下面的指令实现隐藏 index.php:

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

相关推荐:最新的五个Laravel视频教程

以上就是laravel隐藏index.php的方法的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/702264.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-23
下一篇 2022-04-23

发表评论

登录后才能评论

评论列表(0条)

保存