What I want to do;
I want mobile users to be redirected to http://m.site.org/mobile-home.
Being redirected to the m.bzaeds.org isn't an issue. I also have this working fine in Apache, but the same .htaccess rule I have in apache doesn't seem to be working in NGINX. I also tried to convert this exact rule using an NGINX translator, but the rule it gave me did not work either.
RewriteCond %{HTTP_HOST} m.site.org
RewriteCond %{REQUEST_URI} ^\/?$
RewriteRule ^(.*)$ mobile-home [L]
What I've done so far;
So, I have NGINX redirecting to m.site.here/mobile-home. Now, we use a Mobile module that detects if the device connected is a mobile device and automatically applies a custom mobile theme. It is detecting with no issues if a device is a mobile device.
However, it fails to load even though the redirection is working and I looked in the error_log and noticed it was failing because /var/www/html/drupal/mobile-home didn't exist -- which, yes, is true. I'm assuming this has something to do with mobile-home actually being a node, because that's what pages are in drupal.
However, no matter how I tried to create the redirect (or return 301), it either was forbidden, infinite redirect loop of doom, or threw me the aforementioned error.
Any ideas?
Now here is a plethora of confusion that I've tried so far;
location / {
#if ($http_user_agent ~* '(iPhone|iPod|android|blackberry)') {
# rewrite ^/(.*)$ /index.php?q=$1;
#}
#if ($http_host ~ "m.bzaeds.org"){
#rewrite ^(.*)$ /mobile-home [L] RewriteCond $request_filename !-f;
#}
try_files $uri @rewrite;
#try_files $uri /mobile-home break;
}
location @rewrite {
#index index.php;
# if ($http_user_agent ~* ('iPhone|iPod)') {
# rewrite ^(.*)$/index.php http://m.bzaeds.org/mobile-home$1 break;
# }
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn't be needed (GlobalRedirect)
rewrite ^/(.*)$ /index.php?q=$1;
#return 301 /mobile-home break;
(And, I've also tried getting rid of location @rewrite and just doing the main rewrite under location / , but I still got many of the same errors. I just had done this statement like this in my non-mobile version, so, mmyes.)
So, I didn't do this they way I ultimately wanted to with redirection because no matter what I tried it still wouldn't stop looking in the wrong place. However, I did discover that if you are using the module "Mobile Tools" it gives you the option under "Front Page" to set it to a node, in our case, mobile-home rather than index.
Problem fixed, problem solved, good enough.