问题描述
我知道这很模糊,但希望我会对此进行更新,以便在人们提出问题时就足够了。
我们有一个DEV和PROD apache服务器。我们简单的get API调用可在PROD中使用。您调用API,并以json格式返回数据。
现在我们的DEV服务器具有相同的Apache配置,并且重写条件相同,但是,在调用DEV API时,用户将被重定向到前端应用程序(以角度编写)。
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} /api/.* [OR]
#L(ast) flag,if this rule is used stop the rewriting process immediately and don't apply any more rules
RewriteRule ^ - [L] #for all matching,pass the existing path through unmodified
# If above rule did not direct to an existing document,default to index.html
RewriteRule ^ /index.html
由于apache的配置文件相同,所以我很困惑为什么在DEV中重定向用户。我希望DEV中的API调用能够以类似于PROD的json格式返回数据。
解决方法
路由必须从一台服务器更改为另一台