<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>スマートホン on qwerty.work</title>
        <link>https://qwerty.work/tags/%E3%82%B9%E3%83%9E%E3%83%BC%E3%83%88%E3%83%9B%E3%83%B3/</link>
        <description>Recent content in スマートホン on qwerty.work</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>ja-JP</language>
        <lastBuildDate>Wed, 26 Sep 2012 22:02:59 +0900</lastBuildDate><atom:link href="https://qwerty.work/tags/%E3%82%B9%E3%83%9E%E3%83%BC%E3%83%88%E3%83%9B%E3%83%B3/index.xml" rel="self" type="application/rss+xml" /><item>
            <title>.htaccessでスマートホン用のサイトに転送</title>
            <link>https://qwerty.work/post/2012/09/htaccess/</link>
            <pubDate>Wed, 26 Sep 2012 22:02:59 +0900</pubDate>
            <guid>https://qwerty.work/post/2012/09/htaccess/</guid>
            <description>&lt;p&gt;Apatchのmod_rewriteを使ってスマートホン用のサイトにリダイレクトさせる方法をメモ。&lt;/p&gt;&#xA;&lt;p&gt;MovableTypeのプラグインを組み込んでスマホ用のブログページを作りました。&lt;/p&gt;&#xA;&lt;p&gt;PC用のブログはルートディレクトリの「blog」で、スマートホン用のブログを「blog」の中の「i」にしたとします。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img alt=&#34;ディレクトリ&#34; class=&#34;gallery-image&#34; data-flex-basis=&#34;496px&#34; data-flex-grow=&#34;206&#34; height=&#34;150&#34; loading=&#34;lazy&#34; sizes=&#34;(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px&#34; src=&#34;https://qwerty.work/post/2012/09/htaccess/images/WS000000.jpg&#34; width=&#34;310&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt;スマートホンからアクセスを転送するため、「blog」ディレクトリに以下の内容で.htaccessを作成します。&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#スマホサイトにリダイレクト&#xA;RewriteEngine On&#xA;RewriteBase /blog&#xA;RewriteCond %{REQUEST_URI} !^/blog/i/.*$&#xA;RewriteCond %{REQUEST_URI} !^(.JPG|.jpg|.GIF|.gif|.PNG|.png) [NC]&#xA;RewriteCond %{HTTP_USER_AGENT} ^(iPhone|iPod|Android|BlackBerry|Windows.Phone) [NC]&#xA;RewriteCond %{HTTP_USER_AGENT} !iPad [NC]&#xA;RewriteRule ^(.*)$ /blog/i/$1 [R=301,L]&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt;もし、画像やiPadを除き「blog」にスマートホンからアクセスがあった場合は「i」にリダイレクトするという内容。&lt;/p&gt;&#xA;&lt;p&gt;「i」ディレクトリには画像がないため、ブログ内の画像のソースやリンクまでリダイレクトされると画像が表示されず困るので、画像はリダイレクトしないように5行目を加えています。&lt;/p&gt;&#xA;</description>
        </item></channel>
</rss>
