<?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>Developer Suite &#187; .htaccess</title>
	<atom:link href="http://developersuite.net/category/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://developersuite.net</link>
	<description>Web Development Resources</description>
	<lastBuildDate>Fri, 27 Nov 2009 02:27:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>URL Rewriting Examples Using .htaccess</title>
		<link>http://developersuite.net/url-rewriting-examples-using-htaccess/</link>
		<comments>http://developersuite.net/url-rewriting-examples-using-htaccess/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 09:07:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.htaccess]]></category>

		<guid isPermaLink="false">http://developersuite.net/?p=81</guid>
		<description><![CDATA[A common problem if you have a database driven website is you would like to make the urls cleaner and more search engine friendly then try these examples of URL rewriting.
1. Rewriting product.php?id=12 to  product-12.html
This is a simple redirection in which the .php extension is hidden from the browser’s address bar and a dynamic [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">A common problem if you have a database driven website is you would like to make the urls cleaner and more search engine friendly then try these examples of URL rewriting.</p>
<p><strong>1. Rewriting product.php?id=12 to  product-12.html</strong></p>
<p align="justify">This is a simple redirection in which the .php extension is hidden from the browser’s address bar and a dynamic url (containing “?” character) is converted into a static URL.</p>
<pre class="brush: jscript;">RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1</pre>
<p><strong>2. Rewriting product.php?id=12 to  product/your-product/12.html</strong></p>
<p>SEO experts always suggest you display the main keyword(s) in the URL. In the following URL rewriting technique you can display the name of the product in URL.</p>
<pre class="brush: jscript;">RewriteEngine on
RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2</pre>
<p><strong>3. Redirecting non www URL to www URL</strong></p>
<p align="justify">If you type google.com in your browser it will be redirected to www.google.com. If you want to do same with your website then put the following code in a .htaccess file.</p>
<pre class="brush: jscript;">RewriteEngine On
RewriteCond %{HTTP_HOST} ^google\.com$
RewriteRule (.*) http://www.google.com/$1 [R=301,L]</pre>
<p><strong>4. Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz</strong></p>
<p align="justify">If you would like this cleaner and more user friendly URL then you can add the following code to the .htaccess file.</p>
<pre class="brush: jscript;">RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1</pre>
<p><strong>5. Redirecting the domain to a new subfolder thats inside public_html.</strong></p>
<p align="justify">Lets say you have redeveloped your site and all the new developments reside inside the “new” folder inside of the root folder. Then the new development of the website can be accessed like “example.com/new”. Now moving these files to the root folder can be a hectic process so you can create the following code inside the .htaccess file and place it under the root folder of the website. The result is www.example.com points to the files inside “new” folder.</p>
<p><strong> </strong></p>
<pre class="brush: jscript;">RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteCond %{REQUEST_URI} !^/new/
RewriteRule (.*)   /new/$1</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fdevelopersuite.net%2Furl-rewriting-examples-using-htaccess%2F&amp;linkname=URL%20Rewriting%20Examples%20Using%20.htaccess"><img src="http://developersuite.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://developersuite.net/url-rewriting-examples-using-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.234 seconds -->
