开发者

mod_rewrite of from example.com/ to example.com/home/ for certain user-agent

I know it should be simple. But al开发者_运维技巧ways can't get it right. With the following, I can redirect example.com/abc into example.com/home/abc but not example.com/ to example.com/home

RewriteCond %{HTTP_USER_AGENT}  ^.*Chrome.*
RewriteRule ^([^/]+)/?$ home/$1

How can I redirect the / as well?


If you want to redirect everything from Chrome to be under the home/ subdirectory, then try the following, it will match anything or nothing, and append it after home/

RewriteCond %{HTTP_USER_AGENT}  ^.*Chrome.*
RewriteRule ^(.*)$ home/$1
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜