laravel隱藏index.php的方法

laravel隱藏index.php的方法:1、開啟apache mod_rewrite模塊,并修改htaccess文件;2、在nginx配置文件中通過“try_files $uri $uri/…”指令實現隱藏index.php。

laravel隱藏index.php的方法

本文操作環境:windows7系統、Laravel5.7版,DELL G3電腦

laravel 配置 隱藏index.php

Apache

首先保證你的Apache mod_rewrite 模塊已經開啟. 框架默認有一個 public/.htaccess 文件可以實現隱藏 index.php 的訪問.

立即學習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視頻教程

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊9 分享