Controlling access to mobile-specific pages

When the personal computer accesses a mobile, special page (page only for the cellular phone), the Google AdSense is not displayed. Moreover, it introduces the method of limiting the access by the personal computer because there is no advantage in which a mobile page is seen with the personal computer.

What is the page (mobile site) only for the cellular phone?

The page (mobile site) only for the cellular phone is a page made considering seeing with the cellular phone, and the page mainly composed of the character. If capacity on page 1 in CHTML and XHTML uses neither the image, music nor the pictograph within about 5KB as for the description language, the page that can be used only for all almost portable terminals can be done.

Problem : personal computer accesses for only cellular phone page

When the personal computer accesses the page only for the cellular phone, the Google AdSense for mobility is not displayed. It is the one that it wants you to see the page with a usual there is an advertisement if it sees from the side that publishes an ad.

Moreover, only it is hard to see and there not an advantage even if the page only for the cellular phone is seen with the personal computer either.

It collides with the Webmaster guideline of not opening the same contents to the public on two or more pages when the content of the page for the personal computer and the page for mobility is almost the same if it sees from the viewpoint of SEO. From personal computer to the one in page only for cellular phone that wants to be inaccessible therefore

The page only for the cellular phone is excluded from the retrieval of the personal computer.

To inform the search robot that the page only for the cellular phone is almost the same content as the page for the personal computer, and to exclude the page only for the cellular phone from the retrieval of the personal computer, as follows is done.

It is described "rel="canonical"" by using the link element in the head tag on the page only for carrying, and can tell that it wants you to register the page specified by the href attribute in the search engine as formal URL. The possibility that URL not wanted is registered in the search engine can be decreased by doing like this.

<link rel="canonical" http://hogehoge.jp/***/***.html>

The access by the personal computer has been controlled with htaccess. (user agent)

The user agent limits the access excluding a portable terminal and a mobile search robot (in a word personal computer and usual web search robot). The .The content of the htaccess file is as follows. We will recommend here because we are easier than the method to control by the following Internet Protocol addresses.

"%{}" is to mean the server variable should be acquired. "!" is a meaning of the denial. [NC] is to mean there is no "No Case" case sensitivity. [F] is compulsorily an access inhibit It makes it to (Forbidden). "403 : Forbidden" of the HTTP response is returned.

The confirmation camouflages the user agent add-on and accesses a mobile page Firefox. Neatly a mobile page is displayed or 403 screens are displayed, It is OK.

RewriteEngine On
RewriteBase /m/

RewriteCond %{HTTP_USER_AGENT} !(DoCoMo|KDDI|Up\.Browser|Softbank|Vodafone|J-PHONE|DDIPOCKET|Nokia|MOT-|L-mode|Mobile|J-SRD|J-MBS|moba-crawler|froute\.jp) [NC]

RewriteRule ^(.*)$ /403.html [F]

When redirecting forward it (It has the problem)

If redirects it, the last line on this command makes as follows. "R" is compulsorily a meaning of redirecting. It is "302 redirect". It becomes direct. "R=301" is redirected that it is assumed 301 (permanent forwarding) If rewriting is done as for "L", it is a meaning of end "Last" said then.

302 confirmed becoming the error by the mobile site map of the Google Webmaster tool when redirecting it. There was no problem in 403.

RewriteRule ^(.*)$ /hoge.html [R,L]

Setting forwarded to each PC page when PC accesses mobile site

As for the access inhibit, when PC accesses a mobile site as stated above, it is acceptable by 403. However, forwarding to a pertinent page for the personal computer more kindly recommends Google more kindly. I am adopting this method now. Because the page only for the cellular phone is few, it is possible.

Without the directory structure of the page only for the cellular phone as well as the page for the personal computer, it might be difficult when there are a lot of pages only for the cellular phone.

RewriteEngine On
RewriteBase /m/

RewriteCond %{HTTP_USER_AGENT} !(DoCoMo|KDDI|Up\.Browser|Softbank|Vodafone|J-PHONE|DDIPOCKET|Nokia|MOT-|L-mode|Mobile|J-SRD|J-MBS|moba-crawler|froute\.jp) [NC]
RewriteRule ^$ /index.php [R,L]

RewriteCond %{HTTP_USER_AGENT} !(DoCoMo|KDDI|Up\.Browser|Softbank|Vodafone|J-PHONE|DDIPOCKET|Nokia|MOT-|L-mode|Mobile|J-SRD|J-MBS|moba-crawler|froute\.jp) [NC]
RewriteRule ^index\.php$ /index.php [R,L]

RewriteCond %{HTTP_USER_AGENT} !(DoCoMo|KDDI|Up\.Browser|Softbank|Vodafone|J-PHONE|DDIPOCKET|Nokia|MOT-|L-mode|Mobile|J-SRD|J-MBS|moba-crawler|froute\.jp) [NC]
RewriteRule ^earth\.php$ /asn/earth.php [R,L]
	*
	*
	*
	*
RewriteCond %{HTTP_USER_AGENT} !(DoCoMo|KDDI|Up\.Browser|Softbank|Vodafone|J-PHONE|DDIPOCKET|Nokia|MOT-|L-mode|Mobile|J-SRD|J-MBS|moba-crawler|froute\.jp) [NC]
RewriteRule ^(.*)$ /403.shtm [F]

When it is not a search robot for the cellular phone (mobility) and mobility as stated above, it is described that it forwards it to each page for the personal computer. [R] becomes 302 forwarding. [L] is to mean the end when rewriting ends.

Page 403 is displayed at the end when not corresponding to this any. The reason for RewriteRule is that only one line is applied when agreeing with the condition of RewriteCond when whether troublesome writing is so done with what is said.

The access by the personal computer has been controlled with htaccess. (Internet Protocol address)

The access excluding a portable terminal and a mobile search robot (personal computer) is limited with IP. This .The content of the htaccess file is as follows. Only one line is displayed and Internet Protocol address that permits displaying is omitted. It is actually more.

The first added line specifies the file that flies when becoming 403 errors with this control of access (Display it). The last line on a page is my Internet Protocol address.

ErrorDocument 403 /403.html
order deny,allow
deny from all

#http://www.nttdocomo.co.jp/service/imode/make/content/ip/
allow from 210.153.84.0/24
	.
#http://www.au.kddi.com/ezfactory/tec/spec/ezsava_ip.html
allow from 210.230.128.224/28
	.
#https://creation.mb.softbank.jp/web/web_ip.html
allow from 123.108.236.0/24
	.
#http://www.willcom-inc.com/ja/service/contents_service/create/center_info/index.html
allow from 61.198.128.0/24
	.
#http://developer.emnet.ne.jp/ipaddress.html
allow from 117.55.1.224/27
	.
#https://www.google.com/support/webmasters/bin/answer.py?answer=34647&topic=9346
allow from 72.14.199.0/25
	.
#https://help.yahoo.co.jp/help/jp/search/indexing/indexing-27.html
allow from 124.83.159.146
	.
#https://helpguide.livedoor.com/help/search/qa/grp627?id=3399
allow from 203.104.254.0/24

#https://help.goo.ne.jp/help/article/1142/
allow from 210.150.10.32/27
	.
#http://search.froute.jp/howto/crawler.html
allow from 60.43.36.253

#http://crawler.dena.jp/
allow from 202.238.103.126
	.
#MyIP
allow from ***.**.***.**

The htaccess file is made by the automatic operation.

It is serious to make this htaccess file. There is a site where this is made by the automatic operation. It is possible to make it very easily. Because Internet Protocol address sometimes has the change, it is necessary to check it regularly.