用户代理的 mod_rewrite 不起作用?
我想实现以下目标,如果有人使用 Android/iPhone 用户代理进入网站,我想将他的所有 url 重写到一个目录,例如:
user enters -> user served
example.com -> example.com/mobile
example.com/review/12 -> example.com/mobile/review/12
我的 .htaccess 中有以下示例代码片段,但它不起作用。 ..
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Android
RewriteRule ^(.*)/$ mobile/$1
I want to achieve the following, if someone enters site with Android/iPhone user agent, I want to rewrite all his urls to a directory, so for example:
user enters -> user served
example.com -> example.com/mobile
example.com/review/12 -> example.com/mobile/review/12
I have the following example code snippet in my .htaccess, but it's not working...
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Android
RewriteRule ^(.*)/$ mobile/$1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将以下内容添加到站点根目录中的 htaccess 文件中。
如果您想更改用户在浏览器地址栏中看到的内容,请将最后一行更改为
Try adding the following to your htaccess file in the root directory of your site.
If you want to change what the user sees in their browser address bar, change the last line to