J’utilise dudamobile pour créer un site mobile. maintenant je veux revenir au site Web original.
le problème est, google indexer mon site mobile comme ceci:
m.example.com/?url= http://example.com/request-url.html
Je souhaite redirect mon site mobile vers l’original en utilisant httaccess.
Quelle est la bonne façon de le faire?
ce code est-il en dessous du travail?
RewriteEngine on RewriteCond %{HTTP_HOST} ^m\.example\.com$ [NC] RewriteRule ^ https://www.example.com%{REQUEST_URI} [R=301,L]
J’ai leur code de redirection comme ceci:
######### Set cookie for users who return to desktop site RewriteBase / RewriteCond %{QUERY_STRING} no_redirect=true [NC] RewriteRule ^(.*)$ - [co=dm_show_classic:true:.example.com:7200:/] # check no 'dm_show_classic' cookie is set RewriteCond %{HTTP_COOKIE} !dm_show_classic # check if no_redirect was sent in the url RewriteCond %{QUERY_STRING} !no_redirect=true [NC] # check if the user agent matches supported mobile devices RewriteCond %{HTTP_USER_AGENT} ((.*iPhone.*)|(.*iPod.*)|(.*BlackBerry.*)|(.*Android.*)|(.*webOS.*)|(.*Windows\ CE.*)|(.*IEMobile.*)|(.*Opera\ Mini.*)|(.*Opera\ Mobi.*)|(.*HTC.*)|(.*LG-.*)|(.*LGE.*)|(.*SAMSUNG.*)|(.*Samsung.*)|(.*Symbian.*)|(.*Nokia.*)|(.*PlayStation.*)|(.*PLAYSTATION.*)|(.*Nintendo\ DSi.*)|(.*TMO-US_LEO.*)|(.*SEC-SGH.*)|(.*BB10.*)) # check if the request isn't for a static file RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif|png|css|js|txt|ico|pdf|bmp|tif|mp3|wav|wma|asf|mp4|flv|mpg|avi|csv|doc|docx|xls|xlsx|ppt|pptx|zip|rar|tar|gz|dmg|iso)$ [NC] #### If query ssortingng is not empty, then include ############## #RewriteCond %{QUERY_STRING} !^$ # extract the current page url including the query ssortingng RewriteCond http://%{HTTP_HOST}%{REQUEST_URI}?%{QUERY_STRING} ^(.*)$ # redirect the request to mobile domain and pass the page url as a parameter RewriteRule ^(.*)$ http://m.example.com?url=%1 [R=302,L]