<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OhRyan.ca &#187; server</title>
	<atom:link href="http://ohryan.ca/blog/tag/server/feed/" rel="self" type="application/rss+xml" />
	<link>http://ohryan.ca/blog</link>
	<description>Canadian Tech News, Hacks &#38; How To</description>
	<lastBuildDate>Mon, 06 Sep 2010 19:19:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How To Detect Mobile Visitors Using .htaccess Rewrite Rules, Simplified</title>
		<link>http://ohryan.ca/blog/2010/04/10/how-to-detect-mobile-visitors-using-htaccess-rewrite-rules-simplified/</link>
		<comments>http://ohryan.ca/blog/2010/04/10/how-to-detect-mobile-visitors-using-htaccess-rewrite-rules-simplified/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 13:00:27 +0000</pubDate>
		<dc:creator>RyanN</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mobile browser]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rewrite rule]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://ohryan.ca/blog/?p=559</guid>
		<description><![CDATA[Since my original posts on mobile redirection in .htaccess files I&#8217;ve gotten some comments and emails asking for step-by-step guidance on exactly how to &#8220;install&#8221; these rules. I hope this post will answer some of those questions. Before you continue reading, if you have php installed on your server, you may want to consider Andy Moore&#8217;s php [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>Since my <a href="http://ohryan.ca/blog/2007/10/29/htaccess-mobile-browser-redirect/" target="_blank">original</a> <a href="http://ohryan.ca/blog/2009/02/18/revisiting-mobile-redirection-using-htaccess-rewrite-rules/" target="_blank">posts</a> on mobile redirection in .htaccess files I&#8217;ve gotten some comments and emails asking for step-by-step guidance on exactly how to &#8220;install&#8221; these rules. I hope this post will answer some of those questions.</p>
<p>Before you continue reading, if you have php installed on your server, you may want to consider <a href="http://detectmobilebrowsers.mobi/" target="_blank">Andy Moore&#8217;s php based detection solution</a>.</p>
<h3>The Basics</h3>
<p>First off, some basic requirements. You&#8217;ll need:</p>
<ul>
<li><strong>Apache/Linux Hosting</strong>. Microsoft&#8217;s IIS has a completely different method for handling this sort of thing.</li>
<li><strong>FTP access.</strong></li>
<li><a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" target="_blank"><strong>Apache mod_rewrite</strong></a><strong> enabled</strong>. Depending on the type of hosting you have, it may be difficult to determine if you have this module installed and it may be impossible to enable if you don&#8217;t. If the steps below simply don&#8217;t seem to work, there is a good chance you don&#8217;t have mod_rewrite installed. Ask your tech support.</li>
<li><strong>Mobile site in a subdirectory</strong>, eg. www.yourdomain.com/m/. This set of rules I&#8217;ve posted will not work with a mobile subdomain.</li>
</ul>
<h3>The Steps</h3>
<ol>
<li>Download <a href="http://ohryan.ca/blog/wp-content/uploads/mobilerules2.1.txt" target="_blank">mobilerules2.1.txt</a>.</li>
<li>Open the file in your favorite text editor, replace the 2 instances of &#8220;mobiledirectoryhere&#8221; (without quotes) with the directory name you are using for your mobile site. Save it.</li>
<li>Open FTP client, enable &#8216;view hidden files&#8217; &#8211; files beginning with a dot are hidden on linux. This option is typically buried in a &#8220;view&#8221; menu or something to that effect. Results may vary.</li>
<li>Navigate to your site&#8217;s webroot (probably &#8216;htdocs&#8217; or &#8216;www&#8217;).</li>
<li>
<ul>
<li>If there is already a .htaccess file present in the directory. Download it, open it in your favorite text editor. Copy &amp; paste the contents of<a href="http://ohryan.ca/blog/wp-content/uploads/mobilerules2.1.txt" target="_blank">mobilerules2.1.txt</a> into the file. Save it, upload it.</li>
<li>If there is no .htaccess file present. Upload <a href="http://ohryan.ca/blog/wp-content/uploads/mobilerules2.1.txt" target="_blank">mobilerules2.1.txt</a> as is, rename it to .htaccess.</li>
</ul>
</li>
<li>Your Done. Test it from a mobile device.</li>
</ol>
<p>If you have any questions please leave a comment.</p>
<p><strong>Note:</strong> This script treats all opera mini, iphone and android the same as other phones and browsers. Leave some comments if you&#8217;d like me to address this.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://ohryan.ca/blog/2010/04/10/how-to-detect-mobile-visitors-using-htaccess-rewrite-rules-simplified/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Revisiting Mobile Redirection Using .htaccess ReWrite Rules</title>
		<link>http://ohryan.ca/blog/2009/02/18/revisiting-mobile-redirection-using-htaccess-rewrite-rules/</link>
		<comments>http://ohryan.ca/blog/2009/02/18/revisiting-mobile-redirection-using-htaccess-rewrite-rules/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 20:20:52 +0000</pubDate>
		<dc:creator>RyanN</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mobile browser]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rewrite rule]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://ohryan.ca/blog/?p=338</guid>
		<description><![CDATA[Back in 2007 I wrote a post detailing a method for detecting and redirecting mobile browsers using .htaccess. Since then the mobile landscape has changed quite a bit: iPhone and Android have been released, the PDA market is all but dead and phones are better in general. My original post was based on a PHP [...]]]></description>
			<content:encoded><![CDATA[<p>Back in 2007 <a href="http://ohryan.ca/blog/2007/10/29/htaccess-mobile-browser-redirect/" target="_blank">I wrote a post detailing a method for detecting and redirecting mobile browsers using .htaccess</a>. Since then the mobile landscape has changed quite a bit: iPhone and Android have been released, the PDA market is all but dead and phones are better in general.</p>
<p>My original post was based on a PHP script by Andy Moore. It&#8217;s worth noting that he has continued to update his script and now has a fancy little generator to help you create a PHP based redirect ruleset. Check out <a href="http://detectmobilebrowsers.mobi/" target="_blank">detectmobilebrowsers.mobi</a> for more info.</p>
<p>His solution will probably work for a lot of applications, but there are 2 main reasons I prefer using Apache&#8217;s rewrite rules to redirect mobile browsers:<br />
<strong>1) </strong>Application independent. By putting the rules in the root .htaccess file you can easily redirect traffic across multiple directories, independent of any webapp that might or might not be running in those directories.<br />
<strong>2) </strong>Faster. Placing the rewrite rules in apache&#8217;s httpd.conf file is potentially faster, than running the regexp in a php script for every request.</p>
<p>Enough of that, here&#8217;s the updated ruleset.<br />
<code><br />
# don't apply the rules if you're already in the mobile directory, infintine loop<br />
# you'll want to test against the host if you're using a subdomain<br />
RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$<br />
# if the browser accepts these mime-types, it's definitely mobile, or pretending to be<br />
RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC,OR]<br />
# a bunch of user agent tests<br />
RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [NC,OR]<br />
RewriteCond %{HTTP_USER_AGENT} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox"[NC,OR]<br />
RewriteCond %{HTTP_USER_AGENT} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-"[NC,OR]<br />
RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR]<br />
RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|iPhone|android"[NC]<br />
# put your rewrite rules here<br />
</code></p>
<p><a href="/blog/wp-content/uploads/mobilerules20.txt">Text Version</a></p>
<p>As you can see, the user agent list is a fair bit less verbose. I&#8217;ve been testing the ruleset on a very busy site, based on over 250k mobile site hits this set of rules is causing a lot fewer false positives, while not missing any significant number of mobile browsers.</p>
]]></content:encoded>
			<wfw:commentRss>http://ohryan.ca/blog/2009/02/18/revisiting-mobile-redirection-using-htaccess-rewrite-rules/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Linux: Finding Newer Files [OR How To Create A Patch File]</title>
		<link>http://ohryan.ca/blog/2008/03/21/linux-finding-newer-files-or-how-to-create-a-patch-file/</link>
		<comments>http://ohryan.ca/blog/2008/03/21/linux-finding-newer-files-or-how-to-create-a-patch-file/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 19:40:07 +0000</pubDate>
		<dc:creator>RyanN</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://ohryan.ca/blog/2008/03/21/linux-finding-newer-files-or-how-to-create-a-patch-file/</guid>
		<description><![CDATA[The linux `find` command is very powerful, it has tonnes of switches and options that I&#8217;m not terribly familiar with. Even though I&#8217;ve been a LAMP developer for over 5 years, I don&#8217;t work on the command-line too often. Yesterday I ran into a problem that I had never tried to resolve before. I was [...]]]></description>
			<content:encoded><![CDATA[<p>The linux `<a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?find" target="_blank">find</a>` command is very powerful, it has tonnes of switches and options that I&#8217;m not terribly familiar with. Even though I&#8217;ve been a LAMP developer for over 5 years, I don&#8217;t work on the command-line too often. Yesterday I ran into a problem that I had never tried to resolve before. I was working on a large project on a development server and I had some updates I wanted to push to the production server, but I had lost track of which files I had updated. I dug through the find manual for a few minutes and discovered the `-newer` flag, from man &#8220;File was modified more recently than <em>file</em>.&#8221; With this flag you can generate a list of files that are newer than a given file. If I set <em>file</em> to a file I knew had been updated before my last set of changes, I could pull a list of patch files.</p>
<blockquote><p>find /path/to/project/ -newer /path/to/project/last-archive.tgz</p></blockquote>
<p>After some more digging and trial and error I found the proper syntax for rolling up all these files into a nice little patch archive:</p>
<blockquote><p>tar -czvf patch-20070321.tar `find /path/to/project/ -newer /path/to/project/last-archive.tgz -print`</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://ohryan.ca/blog/2008/03/21/linux-finding-newer-files-or-how-to-create-a-patch-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TinyMy, Quick and Dirty MySQL Shell</title>
		<link>http://ohryan.ca/blog/2007/12/07/tinymy-quick-and-dirty-mysql-shell/</link>
		<comments>http://ohryan.ca/blog/2007/12/07/tinymy-quick-and-dirty-mysql-shell/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 13:30:22 +0000</pubDate>
		<dc:creator>RyanN</dc:creator>
				<category><![CDATA[Review]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://ohryan.ca/blog/2007/12/07/tinymy-quick-and-dirty-mysql-shell/</guid>
		<description><![CDATA[Stumbled across a tiny mysql shell &#8211; appropriately named &#8216;tinymy&#8217; &#8211; a few months ago. It&#8217;s quite a useful little bit of PHP code. Very lightweight and function interface and shell for MySQL. I use it whenever I need to verify the contents of a database table or test a couple of queries but don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Stumbled across a tiny mysql shell &#8211; appropriately named &#8216;tinymy&#8217; &#8211; a few months ago.</p>
<p>It&#8217;s quite a useful little bit of PHP code. Very lightweight and function interface and shell for MySQL.  I use it whenever I need to verify the contents of a database table or test a couple of queries but don&#8217;t need a full install phpMyAdmin.</p>
<p>Thought I&#8217;d share.<br />
<a href="http://elfz.laacz.lv/tinymy/">Link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ohryan.ca/blog/2007/12/07/tinymy-quick-and-dirty-mysql-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.htaccess Mobile Browser Redirect</title>
		<link>http://ohryan.ca/blog/2007/10/29/htaccess-mobile-browser-redirect/</link>
		<comments>http://ohryan.ca/blog/2007/10/29/htaccess-mobile-browser-redirect/#comments</comments>
		<pubDate>Tue, 30 Oct 2007 02:37:44 +0000</pubDate>
		<dc:creator>RyanN</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[mobile browsing]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://ohryan.ca/blog/2007/10/29/htaccess-mobile-browser-redirect/</guid>
		<description><![CDATA[UPDATE: New Ruleset Posted &#8211; February 2009 I just finished building out a simple little mobile site for hiphopdx.com. When I asked Google the best way to detect mobile browsers with PHP, it led to me this PHP code by Andy Moore. After a few minutes of contemplating the best way to include the code [...]]]></description>
			<content:encoded><![CDATA[<h2><a href="http://ohryan.ca/blog/2009/02/18/revisiting-mobile-redirection-using-htaccess-rewrite-rules/">UPDATE: New Ruleset Posted &#8211; February 2009</a></h2>
<p>I just finished building out a simple little <a href="http://www.hiphopdx.com/m/" target="_blank">mobile site for hiphopdx.com</a>. When I asked Google the best way to detect mobile browsers with PHP, it led to me this <a href="http://www.andymoore.info/php-to-detect-mobile-phones/" target="_blank">PHP code</a> by Andy Moore. After a few minutes of contemplating the best way to include the code in the existing CMS framework I realized that it would probably be best to move the functionality outside of PHP. I mean, why clutter up display code with HTTP traffic manipulation.  The website&#8217;s main traffic cop Apache is already perfectly capable of handling the duties already.</p>
<p>Here&#8217;s how to redirect mobile traffic using a .htaccess file:</p>
<pre>RewriteEngine On
RewriteCond %{REQUEST_URI} !^/m/.*$
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT}  "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC] #*SEE NOTE BELOW
RewriteRule ^(.*)$ /m/ [L,R=302]</pre>
<p>I did my best to translate the PHP code verbatim, if you want to understand what each line is doing you&#8217;ll want to check out<a href="http://www.andymoore.info/php-to-detect-mobile-phones/" target="_blank"> the original code</a>. Testing for all those user agents is probably a little overkill, but Mr Moore is a &#8220;dotMobi certified mobile web developer&#8221; I&#8217;m going to assume he knows what he&#8217;s talking about.</p>
<p>*The &#8220;tosh&#8221; user agent (I&#8217;m assuming this is for a Toshiba browser?) happens to catch browser on any browser on the Mac OS. I had to add !macintosh to skip macs. The iPhone/iPod Touch does not identify itself as &#8220;macintosh.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://ohryan.ca/blog/2007/10/29/htaccess-mobile-browser-redirect/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
	</channel>
</rss>
