2015-05-22 4 views
1

Я использую WordPress премиум-сайт темы для прессы. Я использую поддомен для мобильного сайта m.coupontales.com, и добавил этот код в файл .htaccess:URL-адрес перенаправления URL-адресов

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. Как заблокировать мои посещения?

ответ

0
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] 

Пожалуйста, перейдите по этой ссылке Mobile Redirect using htaccess

Смежные вопросы