homepage Welcome to WebmasterWorld Guest from 54.196.198.213
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Redirect WWW to non WWW, for primary domain, and parked domain
basketmen




msg:4379420
 12:28 am on Oct 26, 2011 (gmt 0)

Hi guys,

I already know basic Redirect www to non-www, using htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^[url]www.yourdomain.com[/url] [NC]
RewriteRule ^(.*)$ [yourdomain.com...] [L,R=301]







but how if we have parked domain too?

I already tried this but its not works, its says "The page isn't redirecting properly"

RewriteEngine On
RewriteCond %{HTTP_HOST} ^[url]www.yourdomain.com[/url] [NC]
RewriteRule ^(.*)$ [yourdomain.com...] [L,R=301]
RewriteCond %{HTTP_HOST} ^[url]www.yourdomain2.com[/url] [NC]
RewriteRule ^(.*)$ [yourdomain2.com...] [L,R=301]






please share your knowledge, what is the best way for this?

 

g1smd




msg:4379421
 12:34 am on Oct 26, 2011 (gmt 0)

I already know basic Redirect www to non-www, using htaccess:

Use example.com in this forum to prevent URL auto-linking.

You have missing escaping in your patterns. If there's a port number appended to any non-www request, your code fails to redirect it.

There are at least four threads in the last three days with domain canonicalisation code and long discussions as to how it works.

lucy24




msg:4379470
 3:20 am on Oct 26, 2011 (gmt 0)

Where is it supposed to be redirecting from, and where is it supposed to be redirecting to?

I don't mean domain names. I mean actual, physical locations. The request has to arrive at the htaccess containing your Rule, and then it has to go to its destination. If either of those locations is not set up to accept requests, or if there is no DNS to tell it where to go in the first place, there will be a problem. Here it sounds as if the problem is at the receiving end. Are you redirecting requests to a parked domain?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved