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

问题描述 投票:-1回答:1

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

Options +MultiViews

RewriteEngine On

RewriteCond %{REQUEST_FILENAME}.php -f

RewriteRule !.*.php$ %{REQUEST_FILENAME}.php [QSA,L]
php .htaccess
1个回答
0
投票

这将有助于您:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
© www.soinside.com 2019 - 2024. All rights reserved.