<?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>Xavisys&#187; apache</title>
	<atom:link href="http://xavisys.com/category/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://xavisys.com</link>
	<description>WordPress Plugins and Custom WordPress Development</description>
	<lastBuildDate>Wed, 16 Nov 2011 20:45:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://xavisys.com/?pushpress=hub'/>
		<item>
		<title>Redirecting all ServerAliases to a preferred domain with mod_rewrite</title>
		<link>http://xavisys.com/redirecting-all-serveraliases-to-a-preferred-domain-with-mod_rewrite/</link>
		<comments>http://xavisys.com/redirecting-all-serveraliases-to-a-preferred-domain-with-mod_rewrite/#comments</comments>
		<pubDate>Sat, 07 Jul 2007 01:35:46 +0000</pubDate>
		<dc:creator>Aaron D. Campbell</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[redirect]]></category>

		<guid isPermaLink="false">http://xavisys.com/redirecting-all-serveraliases-to-a-preferred-domain-with-mod_rewrite/</guid>
		<description><![CDATA[I had a domain that I owned three TLDs for. I had the .com, the .net, and the .org. These all go to the same site using ServerAlias directives in the apache config. As do the www versions of each. However, I preferred to have them all go to mysite.com with no www. To add [...]]]></description>
			<content:encoded><![CDATA[<p>I had a domain that I owned three TLDs for.  I had the .com, the .net, and the .org.  These all go to the same site using ServerAlias directives in the apache config.  As do the www versions of each.  However, I preferred to have them all go to mysite.com with no www.  To add to the confusion, the site allows (but does not require) SSL, so the user&#8217;s SSL state needed to be preserved during all this rewriting.  Here is what I came up with, and it works great.</p>
<pre class="brush: bash; title: ; notranslate">
&lt;ifmodule&gt;
RewriteEngine On
RewriteCond %{HTTP_HOST}    !^mysite\.com [NC]
RewriteCond %{HTTP_HOST}    !=&quot;&quot;
RewriteCond %{SERVER_PORT}s ^(80s|443(s))$
RewriteRule ^(.*)          http%2://mysite.com/$1 [L,R=301]
&lt;/ifmodule&gt;
</pre>
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://xavisys.com/cell-phone-safe-redirecting-with-mod_rewrite/' title='Cell phone safe redirecting with mod_rewrite'>Cell phone safe redirecting with mod_rewrite</a></li>
<li><a href='http://xavisys.com/php-function-to-redirect-a-user-with-a-message/' title='PHP function to Redirect a user with a message'>PHP function to Redirect a user with a message</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://xavisys.com/redirecting-all-serveraliases-to-a-preferred-domain-with-mod_rewrite/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

