您的位置 首页 php

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 +FollowSymLinksRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^ index.php [L]

Nginx

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

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

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

文章来源:智云一二三科技

文章标题:laravel隐藏index.php的方法

文章地址:https://www.zhihuclub.com/25108.shtml

关于作者: 智云科技

热门文章

网站地图