Welcome to WebmasterWorld Guest from 50.16.24.12

Forum Moderators: phranque

Making links work regardless of .com or .org

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

10+ Year Member



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.

Thanks!

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

WebmasterWorld Senior Member 10+ Year Member



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

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

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

WebmasterWorld Senior Member 10+ Year Member



(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)

10+ Year Member



Great, thank you!
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month

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