<?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>edrackham &#187; .htaccess</title>
	<atom:link href="http://edrackham.com/category/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://edrackham.com</link>
	<description>PHP, MySQL, JavaScript and Other Web Tutorials!</description>
	<lastBuildDate>Thu, 04 Aug 2011 08:30:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Online .htpasswd Generator</title>
		<link>http://edrackham.com/apache/online-htpasswd-generator/</link>
		<comments>http://edrackham.com/apache/online-htpasswd-generator/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 13:51:25 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://edrackham.com/apache/online-htpasswd-generator/</guid>
		<description><![CDATA[Use the following .htpasswd generator to secure your Apache web directories. Your browser does not support IFRAMES. Please view the generator at http://edrackham.com/tutorials/online-htpasswd-generator/ Make sure you have a .htaccess and .htpasswd file in the directory you want to secure, then add the entries once you&#8217;ve generated your password.]]></description>
			<content:encoded><![CDATA[<p>Use the following .htpasswd generator to secure your Apache web directories.</p>
<p><iframe id="htpasswd_generator" name="htpasswd_generator" width="460" scrolling="no" height="130" frameborder="0" src="http://edrackham.com/tutorials/online-htpasswd-generator/?iframe">Your browser does not support IFRAMES. Please view the generator at http://edrackham.com/tutorials/online-htpasswd-generator/</iframe></p>
<p>Make sure you have a .htaccess and .htpasswd file in the directory you want to secure, then add the entries once you&#8217;ve generated your password.</p>
<p><div align="center" style="margin-bottom: 20px;">
<script type="text/javascript"><!--
google_ad_client = "pub-4159646232668987";
google_ad_slot = "5003066961";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
]]></content:encoded>
			<wfw:commentRss>http://edrackham.com/apache/online-htpasswd-generator/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Top 10 .htaccess Tips and Tricks</title>
		<link>http://edrackham.com/apache/top-10-htaccess-tips-and-tricks/</link>
		<comments>http://edrackham.com/apache/top-10-htaccess-tips-and-tricks/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 00:23:39 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://edrackham.com/apache/top-10-htaccess-tips-and-tricks/</guid>
		<description><![CDATA[Custom Error Documents Creating custom documents gives your site a more professional look, as not only are you providing a &#8216;net&#8217; to catch unsuspecting visitors when they follow a bad link and such like, but they also allow you to customise the style of the page so you can maintain your basic site design by [...]]]></description>
			<content:encoded><![CDATA[<h2>Custom Error Documents</h2>
<p>Creating custom documents gives your site a more professional look, as not only are you providing a &#8216;net&#8217; to catch unsuspecting visitors when they follow a bad link and such like, but they also allow you to customise the style of the page so you can maintain your basic site design by adding HTML.</p>
<pre name="code" class="c"># custom error documents
ErrorDocument 401 /error/401.php
ErrorDocument 403 /error/403.php
ErrorDocument 404 /error/404.php
ErrorDocument 500 /error/500.php</pre>
<p><div align="center" style="margin-bottom: 20px;">
<script type="text/javascript"><!--
google_ad_client = "pub-4159646232668987";
google_ad_slot = "5003066961";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<h2>Control Access</h2>
<p>Being able to control access to certain areas of your server can be very useful. The following example demonstrates how to only allow access from those connecting from a 192.168.0 LAN IP pool. This could be easily modified to only allow access from a single remote IP address or addresses.</p>
<pre name="code" class="c"># no nasty crackers in here!
order deny,allow
deny from all
allow from 192.168.0.0/24
# this would do the same thing..
#allow from 192.168.0</pre>
<h2>Hide and Deny Files</h2>
<p>Hiding and denying access to files is crucial to servers that have sensitive data held within files that may be accessible via the website(s) on it. The following example demonstrates how to prevent acces to any files ending with .log &#8211; and is case insensitive (i.e. .LoG / .lOG / .loG).</p>
<pre name="code" class="c"><Files ~ "^.*\.([Ll][Oo][Gg])">
 Order allow,deny
 Deny from all
 Satisfy All
</Files></pre>
<h2>Basic Rewriting</h2>
<p>I have written a <a href="http://edrackham.com/apache/beginners-mod_rewrite-tutorial/" title="mod_rewrite tutorial">mod_rewrite tutorial</a>, but this is worth a mention as a top 10 tip for .htaccess files as it&#8217;s becoming more and more commonly used these days &#8211; primarily for SEO purposes.</p>
<p>This example will redirect a request for <strong>http://edrackham.com/page_one.htm</strong> to <strong>http://edrackham.com/page_one.php</strong>. The <em>r=301</em> tells apache to send a proper HTTP <em>Permanently Moved</em> redirection (301), which will update the address bar in the browser window to show &#8216;page_one.php&#8217;. Without this, you&#8217;d still see &#8216;page_one.htm&#8217; even though you&#8217;re seeing a PHP page. This helps SEO, as spiders and search engines will update their listings to reflect the PHP versions.</p>
<pre name="code" class="c">Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.+)\.htm$ http://edrackham.com/$1.php [r=301,nc]</pre>
<p><div align="center" style="margin-bottom: 20px;">
<script type="text/javascript"><!--
google_ad_client = "pub-4159646232668987";
google_ad_slot = "5003066961";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<h2>Shorter URLs</h2>
<p>Shorter URLs are beneficial, as visitors that persist in typing full URLs won&#8217;t have to type as much, and they&#8217;re more memorable. Do they benefit SEO, even though the full URL contains the same keywords? I don&#8217;t know, maybe someone can tell me.</p>
<p>This example will rewrite a page requested as <strong>http://edrackham.com/files/code/apache.zip</strong> to <strong>http://edrackham.com/download.php?type=code&amp;file=apache</strong>.</p>
<pre name="code" class="c">Options +FollowSymlinks
RewriteEngine on
RewriteRule ^files/(.+)/(.+).zip download.php?type=$1&#038;file=$2 [nc]</pre>
<h2>Prevent Hotlinking</h2>
<p>Preventing hotlinking can reduce bandwidth, by disallowing other websites from displaying images hosted on your server. The following rule basically says that if the referer is NOT edrackham.com, run the following rule. The rule (on the next line) says that if the request is for a .gif, .jpg or.png then redirect the visitor to http://edrackham.com/img/hotlink_f_o.png. I&#8217;ll leave you to work out what the &#8216;f_o&#8217; stands for.</p>
<pre name="code" class="c">Options +FollowSymlinks
# no hot-linking
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?edrackham\.com/ [nc]
RewriteRule .*\.(gif|jpg|png)$ http://edrackham.com/img/hotlink_f_o.png [nc]</pre>
<h2>Hiding Page Extension</h2>
<p>Similar to the mod_rewrite code above, this will redirect a request for <strong>product-<em>3</em>.html</strong> to <strong>products.php?id=<em>3</em></strong>. As we&#8217;re not using <em>r=301</em>, the requested page will remain in the browser&#8217;s address bar.</p>
<pre name="code" class="c">Options +FollowSymlinks
RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ products.php?id=$1</pre>
<h2>Ban Selected User Agents</h2>
<p>In my opinion, it&#8217;d be ace to block all requests from a Microsoft user agent, but alas, that wouldn&#8217;t be too cool as some people are still hell-bent on using a non-standards compliant browser. Having said that, Microsoft is making their new <a href="http://edrackham.com/web-standards/standards-compliant-internet-explorer-ie8/" title="Microsoft to release standards compliant browser. Yes really!">IE8 release standards compliant</a> by default.</p>
<p>The following provides some examples for blocking requests to your server from certain user agents.</p>
<pre name="code" class="c">#####################################
# Deny Useragents
#####################################

RewriteCond %{HTTP_USER_AGENT} ^FrontPage [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Java.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Microsoft.URL [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^MSFrontPage [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Offline.Explorer [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^[Ww]eb[Bb]andit [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus [NC]
RewriteRule ^.*$ - [F]</pre>
<h2>Making Other Filetypes Executable</h2>
<p>Ever wanted to make your site look like it runs off a new language such as .w00t files? Well you can with .htaccess! Adding this neat one-liner, you can request .w00t files, which will be served and interpreted as .php type files.</p>
<pre name="code" class="c">AddType application/x-httpd-php .w00t</pre>
<p><div align="center" style="margin-bottom: 20px;">
<script type="text/javascript"><!--
google_ad_client = "pub-4159646232668987";
google_ad_slot = "5003066961";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<h2>Force Media Downloads</h2>
<p>Sometimes, when clicking on media files, the browser wants to play or stream it directly from itself. Using the following rules, media files (.avi/.mpg/.wmv/.mp3 in this example) will provide a download dialog box instead.</p>
<pre name="code" class="c"># instruct browser to download multimedia files
AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .wmv
AddType application/octet-stream .mp3</pre>
<h2>Require SSL</h2>
<p>Sometimes you will require an SSL connection. This following snippet will do just that!</p>
<pre name="code" class="c"># require SSL
SSLOptions +StrictRequire
SSLRequireSSL
SSLRequire %{HTTP_HOST} eq "domain.tld"
ErrorDocument 403 https://domain.tld

# require SSL without mod_ssl
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]</pre>
<p>Sources:</p>
<p>http://corz.org/serv/tricks/htaccess.php</p>
<p>http://roshanbh.com.np/2008/02/hide-php-url-rewriting-htaccess.html</p>
<p>http://expressproducts.net/htaccess.htm</p>
<p>http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/#usa4</p>
<p>http://phpsecurity.wordpress.com/2007/12/22/htaccess-tips-and-tricks/</p>
]]></content:encoded>
			<wfw:commentRss>http://edrackham.com/apache/top-10-htaccess-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Beginner&#8217;s Mod_Rewrite Tutorial</title>
		<link>http://edrackham.com/apache/beginners-mod_rewrite-tutorial/</link>
		<comments>http://edrackham.com/apache/beginners-mod_rewrite-tutorial/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 14:26:38 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://blog.edrackham.com/apache/beginners-mod_rewrite-tutorial/</guid>
		<description><![CDATA[Have you seen those websites such as Digg and SVP that use fancy URLs such as http://domain.com/page_content? Yeah, sure this could be nearly achieved by simply renaming your pages to something like page_content.htm &#8211; but that would result in you having to change every page on your site to a suitably written filename, as well [...]]]></description>
			<content:encoded><![CDATA[<p>Have you seen those websites such as <a href="http://digg.com" title="Community based popularity website.">Digg</a> and <a href="http://svp.co.uk" title="Cheap computer consumables, hardware and media.">SVP</a> that use fancy URLs such as http://domain.com/<strong>page_content</strong>? Yeah, sure this could be <em>nearly </em>achieved by simply renaming your pages to something like <strong>page_content.htm</strong> &#8211; but that would result in you having to change every page on your site to a suitably written filename, as well as relying on static pages. I&#8217;m going to attempt to demonstrate just how easy it really is to utilise mod_rewrite to have fancy &#8211; even &#8220;web 2.0&#8243; &#8211; URLs within your site.</p>
<p><span id="more-7"></span> Mod_rewrite is useful for pages with dynamic content, such as those which rely on either POST or GET data to generate the content. A URL that looks something like</p>
<p><strong>http://domain.com/product.php?product_id=19</strong></p>
<p>would be ideal to control using mod_rewrite. The main reasons being that:</p>
<ol>
<li>The URL is referencing dynamic content (as the GET suggests in the URL).</li>
<li>The page, product.php, will remain the same &#8211; yet load different data based on the value of the GET variable &#8216;product_id&#8217;.</li>
</ol>
<p><div align="center" style="margin-bottom: 20px;">
<script type="text/javascript"><!--
google_ad_client = "pub-4159646232668987";
google_ad_slot = "5003066961";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<p>So let&#8217;s get started shall we? If you know mod_rewrite works, <a href="#masking_pages_with_mod_rewrite" title="Jump past the boring part.">start masking pages with mod_rewrite</a> now!.</p>
<h3>Testing Mod_Rewrite Works</h3>
<p>In order to use mod_rewrite, you will need the following:</p>
<ul>
<li>The module &#8216;mod_rewrite&#8217; enabled.</li>
<li>Either have direct access to your httpd.conf file <em>which won&#8217;t be entirely discussed in this tutorial</em>, or have the ability to use .htaccess files within your site.</li>
<li>Have the AllowOverride directive within the httpd.conf file set to allow rules for you to use mod_rewrite commands.</li>
</ul>
<p>Don&#8217;t panic &#8211; most Apache web servers have the above enabled and ready to go! Let&#8217;s do a simple test to make sure everything is cool to go. Create a .htaccess file in your site&#8217;s root directory.</p>
<p>Insert the following text into your new .htaccess file:</p>
<pre name="code" class="c">Options +FollowSymLinks
Options +Indexes
RewriteEngine On</pre>
<blockquote><p><strong>NOTE:</strong> The .htaccess file will affect all files within the same directory as itself, as well as sub-directories and their respective files. The directory can change, but for the purposes of this tutorial, we&#8217;re gonna stick this bad boy in your root directory.</p></blockquote>
<p>Upload your .htaccess file to the root directory of your site, and load the index page (well, any valid page for that matter!). One of two things will happen (at least, I think I&#8217;m right here&#8230;). You&#8217;ll find that either:</p>
<ul>
<li>Your requested page loads just fine. <strong><font color="#99cc00">Good</font></strong>.</li>
<li>You get an Internal Server Error (500). <strong><font color="#ff0000">Bad</font></strong>.</li>
</ul>
<p>If you get the Internal Server Error (error 500), I&#8217;m afraid that it looks like either mod_rewrite isn&#8217;t installed, or your httpd.conf file doesn&#8217;t allow the required AllowOverride directives. If this is the case, and you <em>do </em>have access to edit your httpd.conf file, do so and set AllowOverride to ALL for your site root directory:</p>
<pre name="code" class="c">&lt;Directory &quot;/var/www/sites/www.domain.com&quot;&gt;
AllowOverride All
</Directory></pre>
<blockquote><p><strong>NOTE:</strong> You can also add all of the mod_rewrite rules within the httpd.conf file instead of the .htaccess file if you so wish. My preference is to use the .htaccess file as it&#8217;s more portable, and generally easier to edit.</p></blockquote>
<p>After you&#8217;ve edited the httpd.conf file / contacted your server guys or whatever &#8211; you should be good to go. If not, I&#8217;m all out of ideas. Sorry. Try <a href="http://www.google.com/search?q=mod_rewrite+500+error" title="Google FTW!">Google</a> for help :].</p>
<p>Assuming all&#8217;s working well, let&#8217;s get to the cool bits!<br />
<a id="masking_pages_with_mod_rewrite"></a></p>
<h3>Masking Pages with Mod_Rewrite</h3>
<p>This is kind of pointless, but is a simple demonstration for this tutorial. If you don&#8217;t care much for pointless, simple-to-understand demonstrations, <a href="#rewriting_dynamic_urls" title="Rewriting Dynamic URLs">go straight to the useful rewrite rules</a>.</p>
<p>First create two basic HTML pages. Name them &#8216;<a href="http://www.edrackham.com/tutorials/beginners_mod_rewrite_tutorial/page_one.htm" title="My version of Page One." target="_blank">page_one.htm</a>&#8216; and &#8216;<a href="http://www.edrackham.com/tutorials/beginners_mod_rewrite_tutorial/page_two.htm" target="_blank" title="My version of Page Two.">page_two.htm</a>&#8216;. Add a little dummy content to both of them, but make sure they have different content (this is so as we can differentiate the pages). Open your .htaccess file, and if you don&#8217;t have the main opening lines:</p>
<pre name="code" class="c">Options +FollowSymLinks
Options +Indexes
RewriteEngine On</pre>
<p>Add them now. On the next free line, add the following:</p>
<pre name="code" class="c">RewriteRule ^page_one.htm$ page_two.htm [L]</pre>
<p>Now, load page one. What do you see? Page two hopefully. How? Well, the RewriteRule breaks down like this:</p>
<pre name="code" class="c">RewriteRule [FIND THIS] [REPLACE WITH THIS] [FLAGS]</pre>
<p>RewriteRules have 4 main parts to them. The rewrite action:</p>
<pre name="code" class="c">RewriteRule</pre>
<p>Then the FIND THIS part:</p>
<pre name="code" class="c">^page_one.htm$</pre>
<p>This is a regular expression. Everything found in between the circumflex (^) and dollar sign ($) will be searched for and saved as a variable (more on this later). If the FIND THIS value is found, it&#8217;ll be replaced with the third part of the RewriteRule &#8211; the REPLACE WITH THIS:</p>
<pre name="code" class="c">page_two.htm</pre>
<p>The fourth and final part of the RewriteRule is the flags. You can put flags in between square brackets ([ ]) to control how mod_rewrite should deal with the rule itself.</p>
<pre name="code" class="c">[L]</pre>
<p>I&#8217;ve simply used one flag, &#8216;L&#8217;. This means that this is the last rule. As we only have one rule at the moment, using this flag seems appropriate, as it&#8217;s the only, and last, rule. You can use multiple flags, by comma delimiting them. There is a <a href="#mod_rewrite_flags" title="View the list of mod_rewrite flags">list of the flags</a> at the end of this tutorial.<br />
<a id="rewriting_dynamic_urls"></a></p>
<h3>Rewriting Dynamic URLs</h3>
<p>Let&#8217;s take the first URL mentioned in this tutorial as the example for this part of the tutorial:</p>
<p><strong>http://domain.com/product.php?product_id=19</strong></p>
<p>Create a new PHP page called product.php. Add the following code between the <body></body> tags:</p>
<pre name="code" class="php">You are viewing product &lt;?php echo $_REQUEST['product_id']; ?&gt;</pre>
<p>Save, and upload your file. You can <a href="http://www.edrackham.com/tutorials/beginners_mod_rewrite_tutorial/product.php?product_id=19" title="My version of Product.php." target="_blank">view my example of product.php</a> to see how the page changes with the dynamic content from the GET request.</p>
<p><div align="center" style="margin-bottom: 20px;">
<script type="text/javascript"><!--
google_ad_client = "pub-4159646232668987";
google_ad_slot = "5003066961";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<p>Let&#8217;s say you would prefer to use a cleaner URL, such as:</p>
<p><strong>http://domain.com/product/19/</strong></p>
<p>This could be achieved by adding the following line to your .htaccess file:</p>
<pre name="code" class="c">RewriteRule ^product/([0-9]+)/$ product.php?product_id=$1 [NC,L]</pre>
<p>You can <a href="http://www.edrackham.com/tutorials/beginners_mod_rewrite_tutorial/product/25/" title="My mod_rewritten product page.">test this in action</a> if you wish. If we break down the RewritRule into the four parts again, you should be able to see how it&#8217;s working:</p>
<pre name="code" class="c">RewriteRule</pre>
<p>Here, we&#8217;re simply stating that we&#8217;re adding a new rule for mod_rewrite to use.</p>
<pre name="code" class="c">^product/([0-9]+)/$</pre>
<p>As before, this is the FIND THIS value. We are looking for a string within the URL that contains product/[NUMERICAL VALUE]/ &#8211; that is, the word &#8216;product&#8217;, then a forward-slash (/), then a numerical value only, then a final forward slash. The magic here lies between the brackets ( ):</p>
<pre name="code" class="c">([0-9]+)</pre>
<p>The brackets ( ) are telling mod_rewrite to <strong>store whatever it finds within the brackets in a variable</strong>. The [0-9]+ is a simple regular expression allowing only numbers 0 to 9, and the + sign means &#8216;any number of&#8217;. So we can have 99 or 123 for example, <strong>not just one number</strong>, such as a 9 or  a 1.</p>
<p>we finally add a trailing slash (/) at the end to finish what we&#8217;re looking for (as our desired clean URL is  <strong>product/[PRODUCT ID]/</strong>).</p>
<pre name="code" class="c">product.php?product_id=$1</pre>
<p>The third part of our RewriteRule is the REPLACE WITH THIS part. Here you can see the actual page name, with the query string &#8211; but this time there&#8217;s something new. Where we used to have the product ID, we now have a variable $1. $1 will contain the value of the result of the regular expression found within the brackets in the FIND THIS part. Can you see it all falling into place now?</p>
<pre name="code" class="c">[NC,L]</pre>
<p>Finally come the flags. I&#8217;ve used two flags here, NC meaning that the rule is case insensitive (it just protects us incase anyone uses  <strong>http://domain.com/Product/19/ </strong>for example), and L meaning it&#8217;s our last rule.</p>
<p><div align="center" style="margin-bottom: 20px;">
<script type="text/javascript"><!--
google_ad_client = "pub-4159646232668987";
google_ad_slot = "5003066961";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<p>Feel free to <a href="http://www.edrackham.com/tutorials/beginners_mod_rewrite_tutorial/product/19/" title="Check out this working example." target="_blank">check this out with a working example</a>. Change the number from 19 to a different number and see what happens.</p>
<h3>Mod_Rewrite Flags</h3>
<ul>
<li>C &#8211; Chain</li>
<li>E &#8211; Environmental Variable</li>
<li>F &#8211; Forbidden</li>
<li>G &#8211; 410 Gone</li>
<li>L &#8211; Last</li>
<li>N &#8211; Next (Round)</li>
<li>NC &#8211; No Case</li>
<li>NE &#8211; No Escape</li>
<li>NS &#8211; No SubRequest</li>
<li>P &#8211; Proxy</li>
<li>PT &#8211; Pass Through</li>
<li>QSA &#8211; Query String Append</li>
<li>R &#8211; Redirect</li>
<li>S &#8211; Skip</li>
<li>T &#8211; Type</li>
</ul>
<h3>Closure</h3>
<p>I could go on and on with more examples of mod_rewrite, but that would exceed the scope of this tutorial &#8211; seeing as this is only a beginner&#8217;s tutorial. Through this tutorial, I hope that you&#8217;ve learned enough of the basics in order to get you started. You should now know:</p>
<ul>
<li>How to get mod_rewrite working.</li>
<li>How to mask pages.</li>
<li>How to create cleaner URLs for dynamic pages.</li>
</ul>
<h3>Useful Reading &amp; References</h3>
<ul>
<li><a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" title="Apache's Mod_Rewrite Documentation.">Apache&#8217;s Mod_Rewrite Documentation</a></li>
<li><a href="http://www.ilovejackdaniels.com/mod_rewrite_cheat_sheet.png" title="Mod_Rewrite Cheat Sheet.">Mod_Rewrite Cheat Sheet</a></li>
<li><a href="http://www.regular-expressions.info/" title="Regular Expression Tutorials.">Regular Expression Tutorials</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://edrackham.com/apache/beginners-mod_rewrite-tutorial/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
	</channel>
</rss>

