homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

Making links work regardless of .com or .org

 12:00 pm on Mar 18, 2007 (gmt 0)

I have a .org site and I recently acquired the .com domain as well. I recently came to realize that many people are formatting links to our site as [sampleurl.com...] instead of sampleurl.org/link.html. How can I set it up so that when someone types in a URL as .com they get automatically forwarded to the same URL they entered but on the .org side?

I noticed that this happens with wikipedia, for example. If you type in the URL for a wikipedia page but use the .com vs the .org, it switches the entire URL to .org.




 1:22 pm on Mar 18, 2007 (gmt 0)

If you are on an Apache server, you need to look here for the mod_rewrite discussions regarding 301 redirects:

If you are on a Microsoft server someone will be along shortly, maybe.


 3:29 pm on Mar 18, 2007 (gmt 0)

(1) Determine which domain should be the right one (= ".org")
(2) Point DNS for both domains to same location (IP)
(3) In root .htaccess file of "location" insert this (*):

RewriteEngine on 
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} ^(www\.)?domain-name\.com
RewriteRule (.*) [domain-name.org...] [R=301,L]

(4) there is no (4). That's all.

(*) Replace "domain-name" with yours, of course.

Perhaps this thread is useful:

Site change of URL [webmasterworld.com]

I have writte a few detailled posts in that thread.


 8:56 pm on Mar 18, 2007 (gmt 0)

Great, thank you!

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved