如何使用htaccess删除URL中的index.php

时间:2019-03-26 10:27:26

标签: php .htaccess

为什么不使用htaccess删除index.php

Options +MultiViews

RewriteEngine On

RewriteCond %{REQUEST_FILENAME}.php -f

RewriteRule !.*.php$ %{REQUEST_FILENAME}.php [QSA,L]

1 个答案:

答案 0 :(得分:0)

这将帮助您:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]