如何将网站重定向到手机而不是图像文件夹?
我已将此代码添加到我的 .htaccess 中
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ /mobile/ [L,R=302]
,并且我在 http://www.exemple 中拥有所有图像。 com/imgs 文件夹。
当我尝试从手机加载这些图像时,由于重定向,路径似乎错误,即使我使用完整路径调用图像,它也不起作用。
是否有任何解决方法,以便重定向起作用并从存在的路径加载图像,而不是尝试通过强制重定向来加载它们?
I've added this code in my .htaccess
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ /mobile/ [L,R=302]
and I have all of the images in the http://www.exemple.com/imgs folder.
When I try to load those images from my mobile, the path seems wrong because of that redirection and even if I call the image with the full path, it's not working.
Is there any workaround so the redirection works and loads images from the path where there are and not trying to load them with forcing the redirection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以相同的顺序添加此内容:
另外,您是否错过了
RewriteRule ^(.*)$ /mobile/ [L,R 中的
/mobile/
之后的$1
=302]?Add this in the same order:
also, did you miss,
$1
after/mobile/
inRewriteRule ^(.*)$ /mobile/ [L,R=302]
?比如:
应该能解决问题
Something like:
should do the trick