<?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>Nicolas Kuttler &#187; redirect</title>
	<atom:link href="http://www.nkuttler.de/tag/redirect/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nkuttler.de</link>
	<description>WordPress Services, IT Services</description>
	<lastBuildDate>Wed, 28 Jul 2010 23:49:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Redirecting all subdomains to the main domain</title>
		<link>http://www.nkuttler.de/2009/01/11/redirecting-all-subdomains-to-the-main-domain/</link>
		<comments>http://www.nkuttler.de/2009/01/11/redirecting-all-subdomains-to-the-main-domain/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 14:29:30 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[duplicate content]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[virtual hosts]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=313</guid>
		<description><![CDATA[How to redirect a subdomain to the main domain, or a domain to a subdomain. Redirect domain.com to www.domain.com.]]></description>
			<content:encoded><![CDATA[<p>Using the canonical hostname for websites isn&#8217;t an obvious problem. After all, who really cares if your site is accessible at <tt>www.domain.com</tt> and <tt>domain.com</tt>? Search engines, for example, could penalize you for having the same content on both domains. I think that today they are smart enough to discover this specific case though.<span id="more-313"></span></p>
<p>Another problem can happen when you use cookies. If not done correctly, your user&#8217;s cookie won&#8217;t be available to the website when they were stored under <tt>www.domain.com</tt> and he uses <tt>domain.com</tt> the next time he visits. See the <a href="http://cgi.netscape.com/newsref/std/cookie_spec.html">cookie specs</a> for more details.</p>
<p>A quick research led me to a solution for apache that I didn&#8217;t like too much. It involves using <tt>mod_rewrite</tt>. <tt>mod_rewrite</tt> is a great tool, but there&#8217;s a better solution for redirecting to your main domain from subdomains or second level domains. Simply use a catchall virtual host in your apache host configuration file(s) to do the redirects. This will solve all the SEO, caching and cookie issues, and it will save some CPU cycles compared to the <tt>mod_rewrite</tt> or higher level solutions.</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;"># NameVirtualHost *:80</span>
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">80</span>&gt;
    <span style="color: #00007f;">ServerName</span> www.domain.com
    <span style="color: #adadad; font-style: italic;"># This is your main domain</span>
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">80</span>&gt;
    <span style="color: #00007f;">ServerName</span> domain.com
    <span style="color: #00007f;">ServerAlias</span> *.domain.com
    <span style="color: #adadad; font-style: italic;"># This is to make sure that foo.domain.com gets redirected too</span>
    <span style="color: #adadad; font-style: italic;"># If you want to use more virtual hosts on subdomains,</span>
    <span style="color: #adadad; font-style: italic;"># just define them earlier</span>
    <span style="color: #00007f;">Redirect</span> / http://www.domain.com/
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</pre></div></div>

<p>Please refer to the <a href="http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect">mod alias docs</a> to decide which <tt>Redirect</tt> you need, this example uses a 302.</p>
<p>For lighttpd you can use this:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #0000ff;">$HTTP</span><span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;host&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=~</span> <span style="color: #ff0000;">&quot;domain<span style="color: #000099; font-weight: bold;">\.</span>com&quot;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #0000ff;">$HTTP</span><span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;host&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #ff0000;">&quot;www.domain.com&quot;</span> <span style="color: #009900;">&#123;</span>
        url<span style="color: #339933;">.</span>redirect <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>
            <span style="color: #ff0000;">&quot;^(.*)$&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">&quot;http://www.domain.com$1&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>By the way, if you&#8217;re an <tt>IIS</tt> user, you might want to read <a href="http://www.xoc.net/works/tips/domain.asp">this</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2009/01/11/redirecting-all-subdomains-to-the-main-domain/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Mailman, HTTP POST and 301 redirects</title>
		<link>http://www.nkuttler.de/2008/11/09/mailman-and-301-redirects/</link>
		<comments>http://www.nkuttler.de/2008/11/09/mailman-and-301-redirects/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 18:01:38 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mailman]]></category>
		<category><![CDATA[redirect]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=426</guid>
		<description><![CDATA[Why my mailman admin interface stopped working. Nothing happened when I submitted any of the forms. And how I fixed it.]]></description>
			<content:encoded><![CDATA[<p>After changing my domain configuration a little (do 301 redirects from <tt>nkuttler.de</tt> to <tt>www.nkuttler.de/</tt> etc.) I noticed that my mailman web interface stopped working. I tried to moderate, change settings etc., but once the form was submitted nothing happened.<span id="more-426"></span></p>
<p>After some digging I found the problem: 301 redirects don&#8217;t pass POST parameters. And when I configured the mailing list I set the domain to <tt>nkuttler.de</tt>. So mailman sets the form action to <tt>http://nkuttler.de/foo/bar</tt>, this gets redirected to the correct domain, but the POST data is gone. How do you change the web host? I couldn&#8217;t find anything in the admin interface, it looks like you have to do it on the command line.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mailman<span style="color: #000000; font-weight: bold;">/</span>bin
.<span style="color: #000000; font-weight: bold;">/</span>withlist <span style="color: #660033;">-l</span> <span style="color: #660033;">-r</span> fix_url list <span style="color: #660033;">-u</span> www.nkuttler.de<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>This is the precise command for <a href="http://www.debian.org">Debian</a>, on other distros you&#8217;ll have to find the correct location.</p>
<p><b>Update</b>: I&#8217;m not quite sure how I missed it, but the <tt>host_name</tt> parameter should allow you to change this setting as well. For other questions about the default URL you can also read the <a href="http://wiki.list.org/pages/viewpage.action?pageId=4030592">Where can I change a list or the default URL used for the web interface?</a> FAQ entry.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2008/11/09/mailman-and-301-redirects/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
