Welcome to WebmasterWorld Guest from 54.162.167.40

Forum Moderators: phranque

Message Too Old, No Replies

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

Hot Threads This Week

Hot Threads This Month