Home > PHP Framework > Laravel > How to hide index.php in laravel

How to hide index.php in laravel

藏色散人
Release: 2023-01-13 00:40:22
Original
3976 people have browsed it

How to hide index.php in laravel: 1. Enable the Apache mod_rewrite module and modify the htaccess file; 2. Use the "try_files $uri $uri/..." instruction in the Nginx configuration file to hide index. php.

How to hide index.php in laravel

The operating environment of this article: windows7 system, Laravel version 5.7, DELL G3 computer

laravel configuration hidden index.php

Apache

First make sure your Apache mod_rewrite module is turned on. The framework has a public/.htaccess file by default that can hide access to index.php.

If it is invalid If so, you can try the following rules:

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

Nginx

Use the following instructions in the Nginx configuration file to hide index.php:

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

Related recommendations : The latest five Laravel video tutorials

The above is the detailed content of How to hide index.php in laravel. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template