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
精彩评论