feat: initial commit

This commit is contained in:
root
2026-06-14 14:00:24 +08:00
commit 72d388f642
118 changed files with 39015 additions and 0 deletions
Executable
+24
View File
@@ -0,0 +1,24 @@
<IfModule mod_rewrite.c>
# 开启重写引擎
RewriteEngine On
# 对应:index index.html index.htm index.php;
DirectoryIndex index.html index.htm index.php
# 1. 如果请求的是真实存在的目录或文件,直接跳过重写
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
# 2. 对应:location ~ \.php$ { try_files $uri =404; }
# 保护机制:如果请求以 .php 结尾但文件不存在,直接返回 404 (这也能防止下方的规则产生死循环)
RewriteCond %{REQUEST_URI} \.php$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ - [R=404,L]
# 3. 对应:try_files $uri $uri/ @extensionless-php; 以及 rewrite ^(.*)$ $1.php last;
# 将所有找不到的请求追加 .php 后缀进行内部重定向
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ $1.php [L]
</IfModule>