【发布时间】:2025-12-03 23:30:02
【问题描述】:
我有 2 个版本的网站,桌面版和移动版:
我的 htacces 正在将移动设备重定向到移动版本。
问题...
1- 如果访问者来自 google,因为他搜索了“thing”,完整链接显示为“www.olivashot.com/index.php/thing”,它会重定向到“www.mobile.olivashot.com/index.php/thing” (我有一个快乐的访客)
2- 但是如果 google 中的链接是:“www.olivashot.com/thing” >>> 他会被重定向到“www.mobile.olivashot.com” (我正在失去一位访客,因为我没有表现出他的预期)
我认为这是因为我正在重写“某事”以退出 joomla 网站中的默认“index.php”
RewriteBase /
## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ http://www.mobile.olivashot.com/$1/ [R=301,L]
【问题讨论】:
标签: .htaccess redirect mobile joomla