<?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>arkinEx Codex &#187; htaccess</title>
	<atom:link href="http://www.arkinex.com/contains/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.arkinex.com</link>
	<description>the place where all my code can be viewed</description>
	<lastBuildDate>Wed, 04 Nov 2009 20:39:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Force Users to use www.yourdomain.com not yourdomain.com.</title>
		<link>http://www.arkinex.com/guides/94/force-users-to-use-wwwyourdomaincom-not-yourdomaincom/</link>
		<comments>http://www.arkinex.com/guides/94/force-users-to-use-wwwyourdomaincom-not-yourdomaincom/#comments</comments>
		<pubDate>Wed, 20 May 2009 13:48:59 +0000</pubDate>
		<dc:creator>arkin</dc:creator>
				<category><![CDATA[Guides]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://www.arkinex.com/?p=94</guid>
		<description><![CDATA[If your having problems with cookies, and incoming links sometimes varying between www.example.com and example.com, which doesn&#8217;t help SEO. Use this quick fix to solve your problem. RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [QSA,L,R=301] It will forward your users keeping their path and query string. Example: http://test.com/page.html?affiliate_id=1 is redirected to http://www.test.com/page.html?affiliate_id=1 The 301 code [...]]]></description>
			<content:encoded><![CDATA[<p>If your having problems with cookies, and incoming links sometimes varying between www.example.com and example.com, which doesn&#8217;t help SEO.<br />
Use this quick fix to solve your problem.<br />
<span id="more-94"></span></p>
<pre>RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [QSA,L,R=301]</pre>
<p>It will forward your users keeping their path and query string.<br />
Example: http://test.com/page.html?affiliate_id=1 is redirected to http://www.test.com/page.html?affiliate_id=1</p>
<p>The 301 code that is also sent ensures search engines understand that this redirect is permanent which helps your site keep and maximize its SEO ranking.</p>
<p>I hope this helps, as always, ask your questions in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arkinex.com/guides/94/force-users-to-use-wwwyourdomaincom-not-yourdomaincom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blocking users based on IP address from your website</title>
		<link>http://www.arkinex.com/guides/71/blocking-users-based-on-ip-address-from-your-website/</link>
		<comments>http://www.arkinex.com/guides/71/blocking-users-based-on-ip-address-from-your-website/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 15:42:13 +0000</pubDate>
		<dc:creator>arkin</dc:creator>
				<category><![CDATA[Guides]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.arkinex.com/?p=71</guid>
		<description><![CDATA[Heres a really quick method of blocking users from accessing your website using the common mod_rewrite and .htaccess. For this method to work, you need to have FTP access to your website and be able to put this file in your main webpage directory or sub-directory that you want to limit access too. I use [...]]]></description>
			<content:encoded><![CDATA[<p>Heres a really quick method of blocking users from accessing your website using the common mod_rewrite and .htaccess. For this method to work, you need to have FTP access to your website and be able to put this file in your main webpage directory or sub-directory that you want to limit access too.</p>
<p><span id="more-71"></span></p>
<p>I use this method during development mostly, to block prying eyes from viewing my raw files and open indexes.</p>
<p>First of all, if your not already using a <strong>.htaccess</strong> file, create one in the directory of your choice, if you are using one, and don&#8217;t have the next line somewhere in your file, put this line at the top.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">RewriteEngine On</pre></div></div>

<p>This turns the RewriteEngine On. Which is required for blocking the IP&#8217;s.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">RewriteCond <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>REMOTE_ADDR<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">!</span>^192.168.1.100$
RewriteRule .<span style="color: #000000; font-weight: bold;">*</span> - <span style="color: #7a0874; font-weight: bold;">&#91;</span>F,L<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>Add the above code underneath the RewriteEngine On and you will block any IPs other than the one listed, to add more IPs, copy the RewriteCond statement and change the IP address.</p>
<p>Alternitave to the above you can also:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Order Deny,Allow
Deny from 192.168.1.100
Deny from 192.168.1.101</pre></div></div>

<p>Which works without mod_rewrite and relies on mod_access. Either/or, take your pick and use whichever one suits you best, results may vary.</p>
<p>I will make a online tool for this in a few days. Hope this comes in handy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arkinex.com/guides/71/blocking-users-based-on-ip-address-from-your-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Navigation II using Clean Urls</title>
		<link>http://www.arkinex.com/php/tutorials/8/navigation-using-clean-urls-htaccess/</link>
		<comments>http://www.arkinex.com/php/tutorials/8/navigation-using-clean-urls-htaccess/#comments</comments>
		<pubDate>Thu, 01 Nov 2007 21:36:59 +0000</pubDate>
		<dc:creator>arkin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://www.arkinex.com/php/tutorials/8/navigation-using-clean-urls-htaccess/</guid>
		<description><![CDATA[This tutorial will teach you how to implement clean SEO friendly web URLs. Example: Turning /index.php?page=register into http://www.domain.com/register/. First things first, lets explain what SEO friendly web URLs can do. They promote traffic as /home/ is easier to remember than index.php?page=home They are easier for search engines to crawl, some search engines refuse to crawl [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will teach you how to implement clean SEO friendly web URLs.<br />
<strong>Example</strong>: Turning /index.php?page=<strong>register</strong> into http://www.domain.com<strong>/register/</strong>.</p>
<p><span id="more-8"></span>First things first, lets explain what SEO friendly web URLs can do.</p>
<ol>
<li>They promote traffic as /home/ is easier to remember than index.php?page=home</li>
<li>They are easier for search engines to crawl, some search engines refuse to crawl anything after the ?</li>
<li>They are easier to maintain and keep permanent (even if you update your scripts).</li>
<li>They hide the chosen programming language from the visiting users.</li>
</ol>
<p>All you require is an Apache webserver (common among webhosts) &amp; a basic knowledge of PHP.<br />
Lets take a look at my first example, create a file called &#8216;<strong>.htaccess</strong>&#8216; (period then htaccess):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># These hashes are comments, they will explain what I am doing.</span>
<span style="color: #666666; font-style: italic;"># First things first, lets turn on the Rewrite Engine</span>
RewriteEngine On
<span style="color: #666666; font-style: italic;"># Then lets define some rules</span>
RewriteRule ^<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-z0-<span style="color: #000000;">9</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>$ <span style="color: #000000; font-weight: bold;">/</span>index.php?<span style="color: #007800;">page</span>=$<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>NC,L<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>The brackets/parenthesis are used to start a variable, variables are stored in order and are numeric, this is used and referred to later in the Rule using a <strong>$1</strong>. The <strong>[a-z0-9]</strong> signifies it can be any alphabetic or numeric character, and the plus<strong>+</strong> symbol means it has to be more than one character long.  I used a-z0-9 instead of a global (.*) which matches anything because I consider it more secure.</p>
<p>The ^ and $ are a standard regular expression and signify beginning and end, so the user cannot add anything else, (aka. /home/blaaaa would be invalid) and the index.php?page=$1 points back to index.php. At the end of the line, parameters or options are defined. In this case <strong>NC</strong> stands for <strong>Case InSensItIvE</strong> and the <strong>L</strong> stands for <strong>Last Rule</strong>, so if that rule is triggered, no others are.</p>
<p>This example turns http://www.domain.com/downloads/ into http://www.domain.com/index.php?page=downloads.<br />
If you would like to read up on <strong>index.php?page=</strong> methods, please review &#8220;<a href="http://arkinex.psycholz.com/2007/09/15/advanced-navigation-using-includes/" rel="bookmark" title="Permanent Link to ">Advanced Navigation using Includes</a>&#8220;.</p>
<p>Other resources I found useful:</p>
<ul>
<li><a href="http://www.ilovejackdaniels.com/cheat-sheets/mod_rewrite-cheat-sheet/" title="ILoveJackDaniels Mod_Rewrite Cheat Sheet" target="_blank">Mod Rewrite Cheat Sheet</a> (Great to print out)</li>
<li><a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" title="Apache 2.2 Mod_Rewrite Documentation" target="_blank">Apache docs on Mod Rewrite</a> (For the more advanced)</li>
</ul>
<p>Hope you enjoyed this tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arkinex.com/php/tutorials/8/navigation-using-clean-urls-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
