71e0d3ed7e
添加.htaccess文件实现URL重写规则,将所有请求重定向到index.php 修改index.php逻辑,忽略请求路径直接返回固定JSON响应
16 lines
399 B
ApacheConf
16 lines
399 B
ApacheConf
# 启用URL重写引擎
|
|
RewriteEngine On
|
|
|
|
# 基础目录设置
|
|
RewriteBase /
|
|
|
|
# 如果请求的是一个存在的文件或目录,则不进行重写
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
|
|
# 所有请求都重定向到index.php
|
|
RewriteRule ^(.*)$ index.php [L]
|
|
|
|
# 确保查询字符串被保留
|
|
RewriteCond %{QUERY_STRING} .+
|
|
RewriteRule ^(.*)$ index.php?$0 [L,QSA] |