<?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>overfrown &#187; Apache</title>
	<atom:link href="http://www.overfrown.com/category/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.overfrown.com</link>
	<description></description>
	<lastBuildDate>Sat, 18 Sep 2010 15:38:40 +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: Use ModRewrite in .htaccess to include search engine friendly keywords in URLs</title>
		<link>http://www.overfrown.com/2009/10/how-to-use-modrewrite-in-htaccess-to-include-search-engine-friendly-keywords-in-urls/</link>
		<comments>http://www.overfrown.com/2009/10/how-to-use-modrewrite-in-htaccess-to-include-search-engine-friendly-keywords-in-urls/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 02:48:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://www.overfrown.com/?p=28</guid>
		<description><![CDATA[Most CMS&#8217;s offer permalinks in the form of keywords within the URL. Using ModRewrite you can easily accomplish this. First verify ModRewrite is enabled in Apache. Create a test folder within your web root path and then create a file named .htaccess in your new folder containing this text: RewriteEngine On Now visit yourdomain.com/testfolder. If [...]]]></description>
			<content:encoded><![CDATA[<p>Most CMS&#8217;s offer permalinks in the form of keywords within the URL. Using ModRewrite you can easily accomplish this.</p>
<p><strong>First verify ModRewrite is enabled in Apache. </strong><strong><img title="apache" src="http://tuxtraining.com/wp-content/plugins/wp-post-icon/img/apache.gif" alt="" width="48" height="48" align="middle" /></strong></p>
<p>Create a test folder within your web root path and then create a file named .htaccess in your new folder containing this text:</p>

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

<p>Now visit yourdomain.com/testfolder. If you get a 500 / Internal Server Error then you need to enable ModRewrite in Apache.</p>
<p>Once the page is loading without a 500 error, we can continue.</p>
<p>I&#8217;m going to show you how to turn an ugly URL like:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http://www.yourdomain.com/index.php?pageid=49382</pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http://www.yourdomain.com/pages/jewelry-and-watches/49382</pre></div></div>

<p><strong>First, let&#8217;s open .htaccess back up and add the following line:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RewriteRule ^([^/]+)/([0-9]+)[/]?$ index.php?keywords=$1&amp;id=$2</pre></div></div>

<p>Just to explain, the line above is rewriting any requests like:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/testfolder/these-are-my-keywords/123</pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">index.php?keywords=these-are-my-keywords&amp;id=123</pre></div></div>

<p>Remember it&#8217;s not REDIRECTING, it&#8217;s REWRITING. This happens blindly to the user/spiders, so it can add true value to your web structures.</p>
<p><strong>Next create a file named index.php in the same test folder with the following contents:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #666666; font-style: italic;">//dump out $_GET variables</span>
  <span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>You can now visit the page in your browser to see it in action.  </p>
<p>Example URL:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http://www.yourdomain.com/testfolder/the-keywords-you-want/12345</pre></div></div>

<p>You should get output from index.php like:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Array ( [keywords] =&gt; the-keywords-you-want [id] =&gt; 12345 )</pre></div></div>

<p>I have posted a PHP function that will <a href="http://www.overfrown.com/2009/09/title-keywordize-function/">keywordize a page title or description</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.overfrown.com/2009/10/how-to-use-modrewrite-in-htaccess-to-include-search-engine-friendly-keywords-in-urls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

