<?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>Thijs Lensselink&#039;s Blog &#187; mod_rewrite</title>
	<atom:link href="http://lenss.nl/tag/mod_rewrite/feed/" rel="self" type="application/rss+xml" />
	<link>http://lenss.nl</link>
	<description>Webdevelopment and stuff...</description>
	<lastBuildDate>Thu, 26 Apr 2012 21:48:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>301 Redirect losing POST data</title>
		<link>http://lenss.nl/2009/02/301-redirct-losing-post-data/</link>
		<comments>http://lenss.nl/2009/02/301-redirct-losing-post-data/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 13:47:23 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[POST]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=320</guid>
		<description><![CDATA[Earlier this week i implemented the forcing of trailing slashes for some websites. And this worked out great. But today one of the ladies here at the office noticed the contact form on one site wasn&#8217;t functioning properly anymore. So i did some debugging and quickly came to the conclusion the POST data array was [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this week i implemented the forcing of trailing slashes for some websites. And this worked out great.<br />
But today one of the ladies here at the office noticed the contact form on one site wasn&#8217;t functioning properly anymore. </p>
<p>So i did some debugging and quickly came to the conclusion the POST data array was empty after a submit of the form. That&#8217;s weird i thought. And didn&#8217;t really have a clue where to start looking. The code wasn&#8217;t touched for a couple of weeks. Bu then i remembered adding the forcing of the trailing slash.</p>
<p>So i browsed to the contact form and did a view source. And there was the problem. The form submitted to </p>
<blockquote><p>/contact/verstuurd</p></blockquote>
<p>A URL without a trailing slash. This causes apache to rewrite the url to </p>
<blockquote><p>/contact/verstuurd/</p></blockquote>
<p>And this also seems to turn the POST into a GET request.</p>
<p>So to fix it just changed to URL in the form to reflect the correct end point. But i have to say i didn&#8217;t expect this to happen. I understand why it happens. And it&#8217;s pretty logical. But i wonder if there&#8217;s a way around this behavior?</p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2009/02/301-redirct-losing-post-data/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Forcing a trailing slash with mod_rewrite</title>
		<link>http://lenss.nl/2009/02/forcing-a-trailing-slash-with-mod_rewrite/</link>
		<comments>http://lenss.nl/2009/02/forcing-a-trailing-slash-with-mod_rewrite/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 11:29:37 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[slash]]></category>
		<category><![CDATA[trailing]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=276</guid>
		<description><![CDATA[I&#8217;m doing some SEO optimization for a couple of websites. And one of the small steps is to force a trailing slash on all URL&#8217;s that do not point to a file on the server. The reason I&#8217;m doing this is to go around the duplicate content problem. /trip/80 /trip/80/ Both point to the same [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m doing some <a href="http://en.wikipedia.org/wiki/Search_engine_optimization">SEO</a> optimization for a couple of websites. And one of the small steps is to force a trailing slash on all URL&#8217;s that do not point to a file on the server. The reason I&#8217;m doing this is to go around the duplicate content problem.</p>
<blockquote><p>/trip/80<br />
/trip/80/</p></blockquote>
<p>Both point to the same content. But a <a href="http://en.wikipedia.org/wiki/Web_crawler">crawler</a> would see this as two different URL&#8217;s. Which off course is correct. But this can lead to duplicate content being indexed in search engines. Which could result in penalties for the site in question. So to fix this problem we add three simple lines to the main .htaccess file</p>
<blockquote><p># If a requested file does not exists<br />
RewriteCond %{REQUEST_FILENAME} !-f</p>
<p># If a requested directory does not exist<br />
RewriteCond %{REQUEST_FILENAME} !-d</p>
<p># Force a trailing slash to the request<br />
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2009/02/forcing-a-trailing-slash-with-mod_rewrite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
