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
Apache 如何更改.htaccess文件,使其忽略某些文件夹?_Apache_.htaccess_Smartphone - Fatal编程技术网

Apache 如何更改.htaccess文件,使其忽略某些文件夹?

Apache 如何更改.htaccess文件,使其忽略某些文件夹?,apache,.htaccess,smartphone,Apache,.htaccess,Smartphone,我已经尝试过几次了,但是没有找到正确的语法。任何帮助都将不胜感激。我的.htaccess文件如下所示。到目前为止,它一直在做它应该做的事情:将智能手机上的所有访问者重定向到我网站的移动版本。但是现在我需要添加一个命令,它使我的文件管理器中的某些文件夹免受.htaccess的影响。我的代码中需要添加什么 RewriteEngine on RewriteBase / # Check if this is the noredirect query string RewriteCond %{QUERY

我已经尝试过几次了,但是没有找到正确的语法。任何帮助都将不胜感激。我的.htaccess文件如下所示。到目前为止,它一直在做它应该做的事情:将智能手机上的所有访问者重定向到我网站的移动版本。但是现在我需要添加一个命令,它使我的文件管理器中的某些文件夹免受.htaccess的影响。我的代码中需要添加什么

RewriteEngine on
RewriteBase /

# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:www.mconchicago.com]

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]

# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST}          !^m\.
# Can not read and write cookie in same request, must duplicate condition
RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$) 

# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP_COOKIE}        !^.*mredir=0.*$ [NC]

# Now redirect to the mobile site
RewriteRule ^ http://m.mconchicago.com [R,L]

几个月来我一直在想这个问题。今晚,奥德赛终于结束了。我改变了这一部分:

RewriteEngine on
RewriteBase /
这样读:

RewriteEngine on
RewriteRule ^family($|/) - [L]
RewriteRule ^photos($|/) - [L]
RewriteRule ^info($|/) - [L]
RewriteBase /

现在它就像一个符咒。“家庭”、“照片”和“信息”是不受.htaccess影响的文件夹。希望此信息能为其他人节省时间。

作为对您所做工作的旁白:请务必确保智能手机也提供完整版本。我讨厌在手机版本中有些东西工作不好,我的手机可以很好地处理整个网站,但我必须更改浏览器作为其用户代理报告的内容,才能访问整个网站。谢谢你的反馈。始终有一个完整站点的链接。然而,你的思考方式对我来说是一个新的视角。