Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other .htaccess questions about subdomain usage Re: .htaccess questions about subdomain usage

#69304
shaun101
Member

I’m not a rewrite guru, but first you should check/ensure that mod_rewrite is enabled on your server. You can waste a load of time playing with .htaccess and rewrite rules, as well as make yourself go crazy!!

Try these two, hopefully I am not far off!

EG1
Options +FollowSymlinks

RewriteBase /
RewriteCond %{HTTP_HOST} !^http://yourdomain.com$

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} iPhone
RewriteRule .* http://mob.yourdomain.com/ [R]

EG2

Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^http://yourdomain.com$

RewriteCond %{HTTP_USER_AGENT} “iPhone|android”[NC]

# rewrite rules here
RewriteRule ^(.+)$ http://m.mysite.com/$1 [R=302,NC]