<?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>eXclusiveMinds &#187; apache</title>
	<atom:link href="http://eXclusiveMinds.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://eXclusiveMinds.com</link>
	<description>eXclusive resource for programmers, developers and designers</description>
	<lastBuildDate>Sat, 13 Mar 2010 23:28:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple but very useful URL rewriting examples</title>
		<link>http://eXclusiveMinds.com/2009/12/05/simple-but-very-useful-url-rewriting-examples/</link>
		<comments>http://eXclusiveMinds.com/2009/12/05/simple-but-very-useful-url-rewriting-examples/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 00:05:20 +0000</pubDate>
		<dc:creator>eXclusiveMinds</dc:creator>
				<category><![CDATA[Internet Tech]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[URL Rewriting]]></category>

		<guid isPermaLink="false">http://eXclusiveMinds.com/?p=318</guid>
		<description><![CDATA[If you are searching for URL rewriting examples you&#8217;ve been point to right place. We&#8217;ve some examples which can be very useful in many real time development/deployment scenario.

Let&#8217;s dive into some practical examples which can be useful in many scenarios:
Following example display &#8220;mysite.org/article-23.html&#8221; for &#8220;mysite.org/article.php?newsid=23&#8243;.

RewriteEngine on
RewriteRule ^product-&#40;&#91;0-9&#93;+&#41;\.html$ product.php?id=$1

Following example display &#8220;mysite.org/headline/localnews/23.html&#8221; for &#8220;mysite.org/headline.php?newsid=23&#8243;

RewriteEngine on
RewriteRule ^headline/&#40;&#91;a-zA-Z0-9_-&#93;+&#41;/&#40;&#91;0-9&#93;+&#41;\.html$ [...]]]></description>
			<content:encoded><![CDATA[<p>If you are searching for URL rewriting examples you&#8217;ve been point to right place. We&#8217;ve some examples which can be very useful in many real time development/deployment scenario.<br />
<span id="more-318"></span><br />
Let&#8217;s dive into some practical examples which can be useful in many scenarios:</p>
<p>Following example display &#8220;mysite.org/article-23.html&#8221; for &#8220;mysite.org/article.php?newsid=23&#8243;.</p>

<div class="wp_syntax"><table><tr><td><div class="code"><pre class="csharp" style="font-family:Consolas; monospace;">RewriteEngine on
RewriteRule <span style="color: #008000;">^</span>product<span style="color: #008000;">-</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">-</span><span style="color: #FF0000;">9</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">+</span><span style="color: #000000;">&#41;</span>\.<span style="color: #0000FF;">html</span>$ product.<span style="color: #0000FF;">php</span><span style="color: #008000;">?</span>id<span style="color: #008000;">=</span>$<span style="color: #FF0000;">1</span></pre></div></td></tr></table></div>

<p>Following example display &#8220;mysite.org/headline/localnews/23.html&#8221; for &#8220;mysite.org/headline.php?newsid=23&#8243;</p>

<div class="wp_syntax"><table><tr><td><div class="code"><pre class="csharp" style="font-family:Consolas; monospace;">RewriteEngine on
RewriteRule <span style="color: #008000;">^</span>headline<span style="color: #008000;">/</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>a<span style="color: #008000;">-</span>zA<span style="color: #008000;">-</span>Z0<span style="color: #008000;">-</span><span style="color: #FF0000;">9</span>_<span style="color: #008000;">-</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">+</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">/</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">-</span><span style="color: #FF0000;">9</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">+</span><span style="color: #000000;">&#41;</span>\.<span style="color: #0000FF;">html</span>$ headline.<span style="color: #0000FF;">php</span><span style="color: #008000;">?</span>newsid<span style="color: #008000;">=</span>$<span style="color: #FF0000;">2</span></pre></div></td></tr></table></div>

<p>Following example automatically redirect to www URL if user types some non www URL.<br />
Example: if you type &#8220;mysite.org&#8221; it will automatically redirected to &#8220;www.mysite.org&#8221;.</p>

<div class="wp_syntax"><table><tr><td><div class="code"><pre class="csharp" style="font-family:Consolas; monospace;">RewriteEngine On
RewriteCond <span style="color: #008000;">%</span><span style="color: #000000;">&#123;</span>HTTP_HOST<span style="color: #000000;">&#125;</span> <span style="color: #008000;">^</span>mysite\.<span style="color: #0000FF;">org</span>$
RewriteRule <span style="color: #000000;">&#40;</span>.<span style="color: #008000;">*</span><span style="color: #000000;">&#41;</span> http<span style="color: #008000;">:</span><span style="color: #008080; font-style: italic;">//www.mysite.org/$1 [R=301,L]</span></pre></div></td></tr></table></div>

<p>Following example display &#8220;http://www.mysite.com/123&#8243; for &#8220;http://www.mysite.com/newsid=123&#8243;.</p>

<div class="wp_syntax"><table><tr><td><div class="code"><pre class="csharp" style="font-family:Consolas; monospace;">RewriteEngine On
RewriteRule <span style="color: #008000;">^</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>a<span style="color: #008000;">-</span>zA<span style="color: #008000;">-</span>Z0<span style="color: #008000;">-</span><span style="color: #FF0000;">9</span>_<span style="color: #008000;">-</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">+</span><span style="color: #000000;">&#41;</span>$ article.<span style="color: #0000FF;">php</span><span style="color: #008000;">?</span>newsid<span style="color: #008000;">=</span>$<span style="color: #FF0000;">1</span>
RewriteRule <span style="color: #008000;">^</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>a<span style="color: #008000;">-</span>zA<span style="color: #008000;">-</span>Z0<span style="color: #008000;">-</span><span style="color: #FF0000;">9</span>_<span style="color: #008000;">-</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">+</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">/</span>$ article.<span style="color: #0000FF;">php</span><span style="color: #008000;">?</span>newsid<span style="color: #008000;">=</span>$<span style="color: #FF0000;">1</span></pre></div></td></tr></table></div>

<p>Following example point &#8220;http://www.mysite.org&#8221; to &#8220;http://www.mysite.org/russian&#8221;. This is simple example of pointing root folder to subfolder.</p>

<div class="wp_syntax"><table><tr><td><div class="code"><pre class="csharp" style="font-family:Consolas; monospace;">RewriteEngine On
RewriteCond <span style="color: #008000;">%</span><span style="color: #000000;">&#123;</span>HTTP_HOST<span style="color: #000000;">&#125;</span> <span style="color: #008000;">^</span>mysite\.<span style="color: #0000FF;">org</span>$ <span style="color: #000000;">&#91;</span>OR<span style="color: #000000;">&#93;</span>
RewriteCond <span style="color: #008000;">%</span><span style="color: #000000;">&#123;</span>HTTP_HOST<span style="color: #000000;">&#125;</span> <span style="color: #008000;">^</span>www\.<span style="color: #0000FF;">mysite</span>\.<span style="color: #0000FF;">org</span>$
RewriteCond <span style="color: #008000;">%</span><span style="color: #000000;">&#123;</span>REQUEST_URI<span style="color: #000000;">&#125;</span> <span style="color: #008000;">!^/</span>russian<span style="color: #008000;">/</span>
RewriteRule <span style="color: #000000;">&#40;</span>.<span style="color: #008000;">*</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">/</span>russian<span style="color: #008000;">/</span>$<span style="color: #FF0000;">1</span></pre></div></td></tr></table></div>

<img src="http://eXclusiveMinds.Com/?ak_action=api_record_view&id=318&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://eXclusiveMinds.com/2009/12/05/simple-but-very-useful-url-rewriting-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
