I am trying to debug my local mobile website from my phone. My mobile website uses files from my main website, so whenever those files are requested, I redirect the request to the main website.
This works in Chrome/Safari on my Mac, but I get the following error in my iPhone's Safari:
JavaScript: Error
undefined
Error: Script error
http://requirejs.org/docs/errors.html#scripterror
Here is my .htaccess
code that does the rewriting:
# models/collections/helpers/objects/libs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{HTTP_HOST} ^(10\.172\.71\.125|localhost)$ [NC]
RewriteRule ^js/(models|collections|helpers|objects|libs)/(.*?)$ http://local.mysite.co/js/$1/$2 [L,QSA,R=302]
So it checks to see if it can find the file in the current document root (namely, my /mobile
folder inside my main site), and when it notices that it can't be found, it requests it from my main website (local.mysite.co
, which I have set in Apache to be located at /
).
My guess is that the error is giving the requirejs link because I use requirejs to load my files, and since they can't be found (on my iPhone's Safari), it throws that error.
I am using http://10.172.71.125/
as my URL (on both my laptop and iPhone), and it only works on my laptop.
I'm out of ideas here :( Can anyone help me? Thanks in advance.
I ended up using the main IP as my main site and a set a port to direct to the mobile subdomain - that way the mobile site could still send requests to the main site's files by simply removing the port.