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.
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]
Nginx
Use the following instructions in the Nginx configuration file to hide index.php:
location / { try_files $uri $uri/ /index.php?$query_string; }
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!