Forum Moderators: phranque
My goal is to have all user agents iPod and iPhone (I'm making my site mobile) be redirected to sub.domain.com from domain.com. So far I have succeeded in having both user agents be redirected to sub.domain.com/index.php. I want to drop the index.php and have pages redirected to their respective subdomain page.
For example, http://www.example.com/contact/ should redirect to http://sub.example.com/contact/
Here is what I have so far, and I hope that the geniuses on this forum can help me figure out the rest.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (.*iPod.*¦.*iPhone.*) [NC]
RewriteRule ^(.*) http://sub.example.com/$1? [R=301,L]
</IfModule>
This is the .htaccess file in my main domain, by the way.
[edited by: jdMorgan at 1:55 am (utc) on June 13, 2008]
[edit reason] example.com [/edit]
That means that a request for http://www.example.com/contact redirects to http://sub.example.com/index.php instead of http://sub.example.com/contact.
[edited by: jdMorgan at 1:54 am (utc) on June 13, 2008]
[edit reason] example.com [/edit]
Jim
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>