From 7d34946fb5b5c0548e6f7ce88e191ec19ae091da Mon Sep 17 00:00:00 2001 From: zhcnyuyang Date: Thu, 21 Aug 2025 21:09:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8DApache=E3=80=81iis=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/.htaccess | 19 +++++++++++++++++++ public/web.config | 28 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 public/.htaccess create mode 100644 public/web.config diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..2c19af1 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,19 @@ + + # 开启URL重写引擎 + RewriteEngine On + + # 规则 1: 处理根路径 + # 当用户请求确切的根路径 (例如 http://yourdomain.com/) 时 + # 内部重写到 start.html。 + # ^$ 匹配空路径 (即根目录)。[L] 表示这是最后一条规则,如果匹配成功则停止处理。 + RewriteRule ^$ /start.html [L] + + # 规则 2: 处理其他所有路径 (标准的SPA规则) + # 在处理其他路径之前,先确保请求的不是一个真实存在的文件或目录。 + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + + # 如果以上条件满足 (不是文件或目录), + # 则将请求重写到 index.html,让Vue Router处理。 + RewriteRule . /index.html [L] + \ No newline at end of file diff --git a/public/web.config b/public/web.config new file mode 100644 index 0000000..6c03b41 --- /dev/null +++ b/public/web.config @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file