开发者

::: Mod Re-Write /SubDir/ Content --> SubDomain Content

is this possi开发者_开发技巧ble with Mod Re-Write?

  1. IF either mobile users OR searchbots enter server1.com/mobile/
  2. server1/mobile/ url DOES NOT change and
  3. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜