Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess https 301重定向+;移动站点重定向_.htaccess_Redirect_Mobile_Https - Fatal编程技术网

.htaccess https 301重定向+;移动站点重定向

.htaccess https 301重定向+;移动站点重定向,.htaccess,redirect,mobile,https,.htaccess,Redirect,Mobile,Https,我正在尝试设置一个permanet 301重定向,从我站点的所有非https和www版本重定向到https版本,同时将所有移动流量重定向到位于子域上的移动版本 在阅读了一些教程之后,我能够组装这个(它可以工作): 该脚本确实有效,但我的问题是它创建了两个登录页重定向(http、www-->https和https://-->),这会减慢进程,并对seo产生不良影响 有人能告诉我一个很好的解决方案,将所有移动通信重定向到。还有其他一切https://... 我也尝试过使用php头来解决这个问题,但它

我正在尝试设置一个permanet 301重定向,从我站点的所有非https和www版本重定向到https版本,同时将所有移动流量重定向到位于子域上的移动版本

在阅读了一些教程之后,我能够组装这个(它可以工作):

该脚本确实有效,但我的问题是它创建了两个登录页重定向(http、www-->https和https://-->),这会减慢进程,并对seo产生不良影响

有人能告诉我一个很好的解决方案,将所有移动通信重定向到。还有其他一切https://...

我也尝试过使用php头来解决这个问题,但它会产生同样的问题

非常感谢您的帮助


谢谢大家!

Your.htacces首先从http重定向到https。然后对移动通信进行重定向。这将导致非https移动通信的两个重定向


如果您首先执行移动重定向,则在所有情况下都应该只执行一个重定向。

您的.htacces首先执行从http到https的重定向。然后对移动通信进行重定向。这将导致非https移动通信的两个重定向

如果您首先执行移动重定向,那么在所有情况下都应该只执行一个重定向

    RewriteEngine on
RewriteBase /

RewriteCond %{HTTPS} off               [OR]
RewriteCond %{HTTP_HOST} ^www\.(.+)$   [NC]
RewriteRule ^ https:// site here [R=301,L,NE]


RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)

RewriteRule ^ - [CO=mredir:0:https:// site here]

RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP:Profile}       !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT}  "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]


RewriteCond %{HTTP_HOST}          !^m\.

RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$) 


RewriteCond %{HTTP_COOKIE}        !^.*mredir=0.*$ [NC]


RewriteRule ^ https://m. site here [R,L]

RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* – [F,L]