::: Mod Re-Write /SubDir/ Content --> SubDomain Content
is this possi开发者_开发技巧ble with Mod Re-Write?
- IF either mobile users OR searchbots enter server1.com/mobile/
- server1/mobile/ url DOES NOT change and
- the content is served from foo.server1.com
Yes, this can be done using mod_rewrite:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/mobile
RewriteCond %{HTTP_USER_AGENT} ^(iPhone.*|GoogleBot.*)
RewriteRule (.*) http://foo.server1.com%{REQUEST_URI}
Note that with this approach you'd have to list every user-agent you want to match. You could have it all in one rule as I've done, or you could have a separate line for each one.
精彩评论