我使用的是WordPress高级新闻主题网站。我正在使用移动网站m.coupontales.com的一个子域,并在.htaccess文件中添加了以下代码:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^m\. [NC]
RewriteCond %{HTTP_USER_AGENT} !(android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera\smobile|palmos|webos) [NC]
RewriteRule ^ http://www.coupontales.com%{REQUEST_URI} [L,R=302]但作为站点管理员,当我访问m.coupontales.com/wp-admin时,它会重定向到www.coupontales.com。我如何阻止我的访问?
发布于 2015-05-22 13:43:29
RewriteEngine On
# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)noredirect=true(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:%{HTTP_HOST},S]
# Check if this looks like a mobile device
# (You could add another [OR] to the second one and add in what you
# had to check, but I believe most mobile devices should send at
# least one of these headers)
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP:Profile} !^$
# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST} !^m\.
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP:Cookie} !\smredir=0(;|$)
# Now redirect to the mobile site
RewriteRule ^ http://m.example.org%{REQUEST_URI} [R,L]https://stackoverflow.com/questions/30388776
复制相似问题