<?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>Designoplasty Web Design and Development Blog &#187; HTAccess</title>
	<atom:link href="http://designoplasty.com/tag/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://designoplasty.com</link>
	<description>HTML, Javascript, PHP, and Me</description>
	<lastBuildDate>Sat, 14 Aug 2010 06:56:55 +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>Installing MediaWiki</title>
		<link>http://designoplasty.com/2010/03/25/installing-mediawiki/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=installing-mediawiki</link>
		<comments>http://designoplasty.com/2010/03/25/installing-mediawiki/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 23:46:35 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[HTAccess]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[Wiki]]></category>

		<guid isPermaLink="false">http://designoplasty.com/?p=1186</guid>
		<description><![CDATA[Today I installed MediaWiki for the first time to keep track of the documentation behind my various projects. I was finding myself getting reset too many times because I would forget my previous assumptions and my various TextEdit documents were getting lost in an unorganized virtual pile on my desktop. This happens a lot as multiple clients have you switching between tasks.]]></description>
			<content:encoded><![CDATA[<p>Today I installed MediaWiki for the first time to keep track of the documentation behind my various projects. I was finding myself getting reset too many times because I would forget my previous assumptions and my various TextEdit documents were getting lost in an unorganized virtual pile on my desktop. This happens a lot as multiple clients have you switching between tasks.</p>

<p>Installing MediaWiki is theoretically and practically easy, but the first time still takes a few hours. I spent a good amount of time figuring out how to get pretty URLs which was complicated by the fact that my wiki was going to be at the local address <code>http://wiki</code>. Hint: Don&#8217;t name your internal wiki site wiki if you want the process of getting pretty URLs to go quickly. I renamed my wiki directory and site name to something else and proceeded successfully. Luckily, all of that while taking some time, went smoothly.</p>

<p>I have my wiki installed on an Apache virtual host, which the documentation writers don&#8217;t really think of as a common scenario. If you are going to do this and want pretty URLs, just realize you will have to know a little bit about .htaccess files. If it helps, here&#8217;s my .htaccess file I created as part of the process to get pretty URLs:</p>

<pre><code>RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wiki/(.*)$ /index.php?title=$1 [PT,L,QSA]</code></pre>

<p>Overall I am happy with it, although in some ways I&#8217;m just mildly unhappy with it. I would prefer a web based administration page to manually editing the LocalSettings.php file. I would prefer that MediaWiki automatically create the appropriate .htaccess file for pretty URLs based on your installation. (Why would anyone not want pretty URLs?) On the other hand, the installation is pretty smooth and MediaWiki really keeps you focused on content because there isn&#8217;t much else to do but create content. This is a good thing.</p>



]]></content:encoded>
			<wfw:commentRss>http://designoplasty.com/2010/03/25/installing-mediawiki/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTAccess RewriteRule, When it Changes the URL in the Address Bar</title>
		<link>http://designoplasty.com/2009/12/24/htaccess-rewriterule-when-it-changes-the-url-in-the-address-bar/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=htaccess-rewriterule-when-it-changes-the-url-in-the-address-bar</link>
		<comments>http://designoplasty.com/2009/12/24/htaccess-rewriterule-when-it-changes-the-url-in-the-address-bar/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 02:04:57 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[HTAccess]]></category>
		<category><![CDATA[RewriteRule]]></category>
		<category><![CDATA[Web Servers]]></category>

		<guid isPermaLink="false">http://designoplasty.com/?p=1118</guid>
		<description><![CDATA[I have been trying to figure this out for ages. When will RewriteRule change the URL in the browser address bar? Today I read thought the whole Apache mod_rewrite documentation page and I still didn&#8217;t know the answer. But after a ton of searching I finally figured it out, and hope to explain it to [...]]]></description>
			<content:encoded><![CDATA[<p>I have been trying to figure this out for ages. When will RewriteRule change the URL in the browser address bar? Today I read thought the whole <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">Apache mod_rewrite documentation page</a> and I still didn&#8217;t know the answer. But after a ton of searching I finally figured it out, and hope to explain it to you the way I wish someone would have explained it to me from the beginning. </p>

<p>To start off, I think part of the reason this isn&#8217;t explained in a more upfront manner is because the writers of the documentation don&#8217;t really think it&#8217;s a valid question. Yes, if you&#8217;re where I was this morning that sounds ridiculous, and it is, but now I can understand their point of view.</p>

<p>The first rule of RewriteRule is:</p>

<blockquote>RewriteRule never &#8220;changes&#8221; the URL in the user&#8217;s browser window.</blockquote>

<p>Right now you&#8217;re probably saying no way, you&#8217;ve seen it happen, so you know it must be happening somehow. The end result is happening, you are correct, but it&#8217;s not happening the way you might think. RewriteRule does not say to the browser, &#8220;Please change the URL in the address bar to this.&#8221; Instead, sometimes RewriteRule says, &#8220;Oh, the page you&#8217;re looking for doesn&#8217;t exist, try this one instead.&#8221; This is called a redirection.</p>

<h3>Rewrite versus Redirection</h3>

<p>This is a very important distinction to most of us, but it is sort of glossed over in the Apache documentation because its writers forgot how revolutionarily important it is.</p>

<p>A rewrite is when Apache says, &#8220;OK, I am going to handle your request, and internally I am going to change the URL to this other URL. You are never going to see that other URL, but that is the URL that is going to be processed. You will continue to see whatever it is you typed in your browser&#8217;s address bar.&#8221;</p>

<p>A redirection is when Apache says, &#8220;Oh, I recognize that I can&#8217;t help you with this request, I suggest you ask for this URL instead.&#8221; After it says this, it&#8217;s done with you, the request is completely finished, and it has forgotten you ever existed. Your browser, however, receives this information and says, &#8220;Well if they suggest a different URL, I guess I&#8217;ll do my user a favor and request that URL next. Oh, and so my user knows what&#8217;s going on I&#8217;ll change the URL in the address bar.&#8221; Next your browser makes a whole separate request with the new URL. The brand new request is received by the web server and processed. The web server has no knowledge that these two requests are in any way related, and the web server certainly isn&#8217;t the one who changed the URL in the address bar of your browser.</p>

<p>This is a big deal! It&#8217;s totally lost on the writers of the Apache documentation. Because now you know you can effectively do the two things you want to do: change the URL internally or change the URL externally (or both, but in two steps.)</p>

<h3>The Code</h3>

<p>So what&#8217;s the difference between a rewrite and a redirect? One letter: R.</p>

<h4>Rewrite</h4>

<pre><code>RewriteRule ^/cars/acura /cars/honda</code></pre>

<p>Users who request the URL /cars/acura will still see /cars/acura in their address bar but they&#8217;ll see the content as if they had requested /cars/honda. (This is just an example and would lead to duplicate content warnings in Google because two different pages would have the same content.)</p>

<p>A better example:</p>

<pre><code>RewriteRule ^/cars/(.*) /cars.php?make=$1 [QSA]</code></pre>

<p>This will internally rewrite requests to /cars/acura to /cars.php?make=acura so you can pretty up your URL structure. It will handle those requests at the same time. The QSA stands for &#8220;Query String Append&#8221; and means that if the URL came in with additional query string info that will also be appended, not lost.</p>

<h4>Redirect</h4>

<pre><code>RewriteRule ^/cars/acura /cars/honda [R]</code></pre>

<p>This is the exact same example as the first example above except for the [R]. The R says, do a redirect which means once Apache is done processing the RewriteRule directives, it will stop processing the request and send the redirect message back to the browser as we discussed at the beginning of this post. This means the browser will most likely change the URL in the address bar and make a new request. There will be two web server requests, which are totally unrelated as far as the web server is concerned.</p>

<p>I should say, for the record, that normally the above code would be written as:</p>

<pre><code>RewriteRule ^/cars/acura /cars/honda [R=301,L]</code></pre>

<p>By default R returns code 302, meaning &#8220;moved temporarily&#8221; which isn&#8217;t often what people like you and me want. We want 301, meaning &#8220;moved permanentaly&#8221; which will also direct search engines to update their URL. The L means if a URL has matched this directive, do the redirect immediately and don&#8217;t process any more directives. Most of the time we don&#8217;t have complex sets of directives that all need to be processed, so just get out early to improve performance.</p>

<h3>More on Redirects</h3>

<p>I won&#8217;t go into detail here, but there are more things than just [R] that will force a redirect, for instance if you&#8217;ve given a substitution URL on another domain. Read the docs for more of those types of situations.</p>

<h3>Conclusion</h3>

<p>Hopefully this has been as helpful to you as finally figuring this out has been to me. It feels so good to finally have a good grasp on this topic.</p>


]]></content:encoded>
			<wfw:commentRss>http://designoplasty.com/2009/12/24/htaccess-rewriterule-when-it-changes-the-url-in-the-address-bar/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
