Laravel隐藏index.php的方法

 1914

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


Laravel隐藏index.php的方法


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;
}


TAG标签:
本文网址:https://www.zztuku.com/detail-8908.html
站长图库 - Laravel隐藏index.php的方法
申明:如有侵犯,请 联系我们 删除。

评论(0)条

您还没有登录,请 登录 后发表评论!

提示:请勿发布广告垃圾评论,否则封号处理!!

    编辑推荐