<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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/"
> <channel><title>Comments on: Apache redirect www.domain.com to domain.com</title> <atom:link href="http://www.cyberciti.biz/faq/apache-httpd-remove-www-from-urls/feed/" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/faq/apache-httpd-remove-www-from-urls/</link> <description>Every answer asks a more beautiful question.</description> <lastBuildDate>Fri, 10 Feb 2012 19:55:56 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Stefan</title><link>http://www.cyberciti.biz/faq/apache-httpd-remove-www-from-urls/#comment-66883</link> <dc:creator>Stefan</dc:creator> <pubDate>Sat, 14 Jan 2012 16:41:34 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1066#comment-66883</guid> <description>Hey there. I just created this script. it is independent of domain (will work on any domain)
RewriteCond %{HTTP_HOST} ^[^(www)] [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI}?%{QUERY_STRING} [R=301,L]</description> <content:encoded><![CDATA[<p>Hey there. I just created this script. it is independent of domain (will work on any domain)</p><p>RewriteCond %{HTTP_HOST} ^[^(www)] [NC]<br
/> RewriteRule ^(.*)$ <a
href="http://www.%" rel="nofollow">http://www.%</a>{HTTP_HOST}%{REQUEST_URI}?%{QUERY_STRING} [R=301,L]</p> ]]></content:encoded> </item> <item><title>By: foo</title><link>http://www.cyberciti.biz/faq/apache-httpd-remove-www-from-urls/#comment-46615</link> <dc:creator>foo</dc:creator> <pubDate>Mon, 29 Mar 2010 12:55:29 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1066#comment-46615</guid> <description>Steve: just remove the / before $1</description> <content:encoded><![CDATA[<p>Steve: just remove the / before $1</p> ]]></content:encoded> </item> <item><title>By: Steve Dalton</title><link>http://www.cyberciti.biz/faq/apache-httpd-remove-www-from-urls/#comment-45769</link> <dc:creator>Steve Dalton</dc:creator> <pubDate>Sun, 31 Jan 2010 11:33:24 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1066#comment-45769</guid> <description>This worked for me, but after the redirect I get an extra slash on the end of the URL. eg.
http://www.domain.com -&gt; http://domain.com//
http://www.domain.com/apage.html -&gt; http://domain.com//apage.html
That works fine - but looks odd.
Also - any hints on getting this going for https (as well as http) too?
ie. https://www.domain.com -&gt; https://domain.com</description> <content:encoded><![CDATA[<p>This worked for me, but after the redirect I get an extra slash on the end of the URL. eg.</p><p><a
href="http://www.domain.com" rel="nofollow">http://www.domain.com</a> -&gt; <a
href="http://domain.com//" rel="nofollow">http://domain.com//</a><br
/> <a
href="http://www.domain.com/apage.html" rel="nofollow">http://www.domain.com/apage.html</a> -&gt; <a
href="http://domain.com//apage.html" rel="nofollow">http://domain.com//apage.html</a></p><p>That works fine &#8211; but looks odd.</p><p>Also &#8211; any hints on getting this going for https (as well as http) too?</p><p>ie. <a
href="https://www.domain.com" rel="nofollow">https://www.domain.com</a> -&gt; <a
href="https://domain.com" rel="nofollow">https://domain.com</a></p> ]]></content:encoded> </item> <item><title>By: MTBVulture</title><link>http://www.cyberciti.biz/faq/apache-httpd-remove-www-from-urls/#comment-39574</link> <dc:creator>MTBVulture</dc:creator> <pubDate>Mon, 22 Dec 2008 22:16:31 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1066#comment-39574</guid> <description>Hi,
I’m in a “extremely incompetent hosting company” situation :) that don’t permit me to use my website without DNS.
Now I’ve put a webserver APACHE on my PC always on with static IP and I’ve forwarded the DNS * and @ to my IP to get the request without www for my website and “redraw” them with WWW.
I have some problems in doing this.
For now I’ve tried this:
$server = $_SERVER[&#039;SERVER_NAME&#039;]; header(&#039;Location: http://www.&#039; . $server);
but doesen’t work with every page (i.e. http://website.ext/* for every possible string in *).
Can you suggest me how to fix this problem?
I repeat, I have an apache webserver so I can also modify settings in apache if is not possible to do this only with PHP.
Thanks so much.
PS: It can be better if this fix works independent by domain name, so I can help people with same problem.
For knowing, the hosting company is TopHost.it
I remember you that my website is hosted OUTSIDE my pc! SO I need only a REDIRECT</description> <content:encoded><![CDATA[<p>Hi,<br
/> I’m in a “extremely incompetent hosting company” situation :) that don’t permit me to use my website without DNS.<br
/> Now I’ve put a webserver APACHE on my PC always on with static IP and I’ve forwarded the DNS * and @ to my IP to get the request without www for my website and “redraw” them with WWW.<br
/> I have some problems in doing this.<br
/> For now I’ve tried this:</p><p>$server = $_SERVER['SERVER_NAME']; header(&#8216;Location: <a
href="http://www." rel="nofollow">http://www.</a>&#8216; . $server);</p><p>but doesen’t work with every page (i.e. <a
href="http://website.ext/" rel="nofollow">http://website.ext/</a>* for every possible string in *).<br
/> Can you suggest me how to fix this problem?<br
/> I repeat, I have an apache webserver so I can also modify settings in apache if is not possible to do this only with PHP.<br
/> Thanks so much.<br
/> PS: It can be better if this fix works independent by domain name, so I can help people with same problem.<br
/> For knowing, the hosting company is TopHost.it<br
/> I remember you that my website is hosted OUTSIDE my pc! SO I need only a REDIRECT</p> ]]></content:encoded> </item> <item><title>By: Igor</title><link>http://www.cyberciti.biz/faq/apache-httpd-remove-www-from-urls/#comment-38029</link> <dc:creator>Igor</dc:creator> <pubDate>Tue, 03 Jun 2008 12:05:14 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1066#comment-38029</guid> <description>Hi,
can someone pls write me how to have primary apache server through https which will send requests to some local apache through http.
Cheers, Igor</description> <content:encoded><![CDATA[<p>Hi,</p><p>can someone pls write me how to have primary apache server through https which will send requests to some local apache through http.</p><p>Cheers, Igor</p> ]]></content:encoded> </item> </channel> </rss>
