I would like my mobile web app to use the same resources (models, collections, etc.) as my web app, but I am getting 404s. I am using RequireJS (which loads these files), as well as Backbone and jQuery Mobile.
My apps are structured as follows:
/
/js
/models
/collections
/mobile
/js
My subdomain m.mysite.com points to /mobile. I want all requests for m.mysite.com/js/models to redirect to mysite.com/js/models, and similarly for collections and others.
I have come up with the following code, but it isn’t working and I’m still getting 404s:
# 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]
Note: I prefixed my local server with local..
You can’t match against the hostname in a
RewriteRule, you’ll need to use aRewriteCondand match against %{HTTP_HOST}: