<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1043788" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1043788</link>
    <description></description>
    <language>en</language>
          <item>
    <title>I would like to see a</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/redirecting-http-httpwww#comment-1241505</link>
    <description> &lt;p&gt;I would like to see a working example of this javascript code that DOES work on a browser with javscript shut off.&lt;/p&gt;
&lt;p&gt;BTW, here is how I have my things set up.&lt;/p&gt;
&lt;p&gt;I have one domain name that is using DynDNS to get routed to my server at home, both domain1.com and &lt;a href=&quot;http://www.domain1.com&quot; title=&quot;www.domain1.com&quot;&gt;www.domain1.com&lt;/a&gt; go there.&lt;/p&gt;
&lt;p&gt;For domain2.com, it is set up for a very basic account at a hosting company (so that my e-mail goes there, and I can transfer backups to that account). But, I actually want the web site to be on my home server. So I create custom DNS entry with &lt;a href=&quot;http://www.domain2.com&quot; title=&quot;www.domain2.com&quot;&gt;www.domain2.com&lt;/a&gt; being a CNAME for domain1.com  (just domain2.com cannot be a CNAME, it has to be an A record to point to a static IP address, which I&#039;m not paying an additional $40 a month for)&lt;/p&gt;
&lt;p&gt;So now if you go to &lt;a href=&quot;http://domain2.com&quot; title=&quot;http://domain2.com&quot;&gt;http://domain2.com&lt;/a&gt; it goes to the hosting account, and &lt;a href=&quot;http://www.domain2.com&quot; title=&quot;http://www.domain2.com&quot;&gt;http://www.domain2.com&lt;/a&gt; goes to my own server. Here is what all I have in place to redirect people from the hosting account over to my own server. I place this in a .htaccess file in the root of the domain&#039;s directory:&lt;/p&gt;
&lt;p&gt;RewriteEngine On&lt;br /&gt;
RewriteRule ^.*$     http://www.domain2.com%{REQUEST_URI} [R]&lt;/p&gt;
&lt;p&gt;Note, the simplicity of this works as the www. and non www. are on two separate servers, so there is no need to do any checking.&lt;/p&gt;
&lt;p&gt;IMO, here is an order to attempt to define things:&lt;/p&gt;
&lt;p&gt;DNS records&lt;br /&gt;
Server Settings&lt;br /&gt;
Serverside Scripting redirect&lt;br /&gt;
Meta tag redirect&lt;br /&gt;
Javascript redirect&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Mon, 11 May 2009 13:28:57 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1241505 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Don&#039;t worry I have tested it</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/redirecting-http-httpwww#comment-1241503</link>
    <description> &lt;p&gt;Don&#039;t worry I have tested it in all types of browsers and also tested it without enabling the javascript, here its working fine and there is no problem with this code its easy to understand and be sure it will work in other browsers which has not mentioned above, if you wish you can also add other name ..i just provided the alternate method to your question one can easily add this code and it redirect to desired site within half second of time....If is there any fault with my code then I am sorry.&lt;/p&gt;
 </description>
     <pubDate>Mon, 11 May 2009 11:21:15 +0000</pubDate>
 <dc:creator>articlemaster</dc:creator>
 <guid isPermaLink="false">comment 1241503 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>What happens if they don&#039;t</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/redirecting-http-httpwww#comment-1241489</link>
    <description> &lt;p&gt;What happens if they don&#039;t have Javascript enabled? Or they have a different browser to the above?&lt;/p&gt;
 </description>
     <pubDate>Sun, 10 May 2009 13:18:16 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1241489 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Hello Friend PLZ ADD THIS</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/redirecting-http-httpwww#comment-1241487</link>
    <description> &lt;p&gt;Hello Friend PLZ ADD THIS CODE IN BETWEEN THE HEAD TAG  of your index page and just change the desire redirect domain with it, when any visitor will come to your site it will redirect then to your another site.Hope you are searching for this, if it is then plz use the following patch of code in your site.&lt;br /&gt;
Thanks.&lt;br /&gt;
_________________________________________________________________________&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;script&amp;gt;&lt;br /&gt;var browser_type=navigator.appName&lt;br /&gt;var browser_version=parseInt(navigator.appVersion)&lt;br /&gt;&lt;br /&gt;//if NS 6&lt;br /&gt;if (browser_type==&amp;quot;Netscape&amp;quot;&amp;amp;&amp;amp;browser_version&amp;gt;=5)&lt;br /&gt;window.location.replace(&amp;quot;http://www.discusionpoint.com/forum/&amp;quot;)&lt;br /&gt;//if IE 4+&lt;br /&gt;else if (browser_type==&amp;quot;Microsoft Internet Explorer&amp;quot;&amp;amp;&amp;amp;browser_version&amp;gt;=4)&lt;br /&gt;window.location.replace(&amp;quot;http://www.discusionpoint.com/forum/&amp;quot;)&lt;br /&gt;//if NS4+&lt;br /&gt;else if (browser_type==&amp;quot;Netscape&amp;quot;&amp;amp;&amp;amp;browser_version&amp;gt;=4)&lt;br /&gt;window.location.replace(&amp;quot;http://www.discusionpoint.com/forum/&amp;quot;)&lt;br /&gt;//Default goto page (NOT NS 4+ and NOT IE 4+)&lt;br /&gt;else&lt;br /&gt;window.location=&amp;quot;http://www.discusionpoint.com/forum/&amp;quot;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
__________________________________________________________________________&lt;/p&gt;
 </description>
     <pubDate>Sun, 10 May 2009 06:15:44 +0000</pubDate>
 <dc:creator>articlemaster</dc:creator>
 <guid isPermaLink="false">comment 1241487 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Yes, the [OR] probably</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/redirecting-http-httpwww#comment-1241243</link>
    <description> &lt;p&gt;Yes, the [OR] probably caused a problem because that&#039;s an OR statement when I had other conditions.  You took out the conditions and left the OR, which probably confused the server.&lt;/p&gt;
&lt;p&gt;I did have the RewriteEngine On statement, but that was all the way at the top of my .htaccess file, and I have a ton of other junk I didn&#039;t copy.&lt;/p&gt;
 </description>
     <pubDate>Sun, 03 May 2009 15:41:54 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1241243 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I just can&#039;t get it to work.</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/redirecting-http-httpwww#comment-1241233</link>
    <description> &lt;p&gt;I just can&#039;t get it to work. Whatever I try it seems to do nothing.&lt;br /&gt;
I can&#039;t even get a 500 error (dammit at least I&#039;d have done something then).&lt;/p&gt;
&lt;p&gt;I&#039;m using your code and removing the two you have for redirecting your .net to .com, and switching the http / www around.&lt;/p&gt;
&lt;p&gt;Like so:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;RewriteCond %{HTTP_HOST} ^site.com$ [NC,OR]&lt;br /&gt;RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Edit&lt;br /&gt;
It seems the rewrite engine is not on by default on the server as I thought it was. Turning it on in the htaccess now gives me an infinite loop with the above code, but I resolved that now as I used the [NC,OR]. Got rid of the OR (fairly logical I guess) and now it works.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;For anyone reading and needing the working code:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;#redirect all and any pages from http:// to &lt;a href=&quot;http://www.&lt;br /&gt;RewriteCond&quot; title=&quot;http://www.&lt;br /&gt;RewriteCond&quot;&gt;http://www.&lt;br /&gt;RewriteCond&lt;/a&gt; %{HTTP_HOST} ^site.com$ [NC]&lt;br /&gt;RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 03 May 2009 14:11:00 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1241233 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>It looks like that will only</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/redirecting-http-httpwww#comment-1241225</link>
    <description> &lt;p&gt;It looks like that will only work if they go to your home page.  What if somebody linked &lt;a href=&quot;http://example.com/insidepage.htm&quot; title=&quot;http://example.com/insidepage.htm&quot;&gt;http://example.com/insidepage.htm&lt;/a&gt; ?  Here is what I use on my site:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;########################################&lt;br /&gt;# make sure we are at the right domain #&lt;br /&gt;########################################&lt;br /&gt;&lt;br /&gt;RewriteCond %{HTTP_HOST} ^www.wells-it.net$ [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_HOST} ^wells-it.net$ [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_HOST} ^www.wells-it.com$ [NC]&lt;br /&gt;RewriteRule ^(.*)$ http://wells-it.com/$1 [R=301,L]&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;(I am forcing the opposite, which is www to no www, so change as necessary)&lt;/p&gt;
 </description>
     <pubDate>Sun, 03 May 2009 11:28:46 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1241225 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
