【发布时间】:2025-12-24 20:55:12
【问题描述】:
我正在寻求有关 .htaccess 文件的帮助。
我想为domain.net/test.php 做domain.net/test 和domain.net/folder 为domain.net/folder/index.php。这可能吗?
【问题讨论】:
我正在寻求有关 .htaccess 文件的帮助。
我想为domain.net/test.php 做domain.net/test 和domain.net/folder 为domain.net/folder/index.php。这可能吗?
【问题讨论】:
您可以在站点根目录 .htccess 中使用此代码:
DirectorySlash On
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
【讨论】: