diff --git a/.htaccess b/.htaccess index fdb01af..5e2f2ac 100644 --- a/.htaccess +++ b/.htaccess @@ -3,4 +3,10 @@ LimitRequestBody 524288000 # 错误处理 ErrorDocument 500 /error_pages/500.html -ErrorDocument 404 /error_pages/404.html \ No newline at end of file +ErrorDocument 404 /error_pages/404.html + +# API 伪静态规则 +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^api(/.*)?$ api.php?action=$1 [QSA,L] \ No newline at end of file diff --git a/api.php b/api.php index 4322053..353d3a5 100644 --- a/api.php +++ b/api.php @@ -6,7 +6,7 @@ header('Content-Type: application/json'); $requestMethod = $_SERVER['REQUEST_METHOD']; // API根路径处理 - 返回可用端点信息 -if (!isset($_GET['action'])) { +if (!isset($_GET['action']) || $_GET['action'] === '') { http_response_code(200); echo json_encode([ 'status' => 'success',