laravel隐藏index.php的方法

来自:互联网
时间:2021-05-27
阅读:

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;
}
返回顶部
顶部