我希望我的移动网络应用程序使用与我的网络应用程序相同的资源(模型、集合等),但我得到了 404。我正在使用 RequireJS(加载这些文件),以及 Backbone 和 jQuery Mobile。
我的应用程序结构如下:
/
/js
/models
/collections
/mobile
/js
我的子域m.mysite.com
指向/mobile
. 我希望所有请求m.mysite.com/js/models
都重定向到mysite.com/js/models
,以及类似的collections
和其他请求。
我想出了以下代码,但它不工作,我仍然得到 404:
# Redirect all calls to '/models' or '/collections' to regular domain
RewriteRule local\.m\.mysite\.co/js/(models|collections|helpers|objects)/(.*?)$ mysite.co/js/$1/$2
[L,QSA,R=301]
注意:我在本地服务器前面加上local.
.