mvc3 routing with 2 different domains
I've developed a multi-culture app in mvc3. I have a table that holds a domain list (currently 2 records):
- www.mydomain.com -> en-US
- www.mydomain.pl -> pl-PL
My app dynamically checks which domain you're comin开发者_如何学Gog from and then sets the CurrentCultureUI depending on the domain. This works fine on my localhost as I've also added these domains to my host file, however i'm not sure how I would handle this on the live envirenment?? (yes i did purchase both domains already) any ideas?
EDIT: I've purchased a '.com' domain AND Hosting from godaddy AND another '.pl' domain from a different registrar (home.pl). I've uploaded my site to the godaddy but the 'pl' version doesn't work. Now, when i go to my domain mngr for '.pl' domain i have an option to "use other host" and text boxes for "DNS" and "IP". Is this what i need to do? what would i need to get from godaddy? to 'home.pl' domain configuration??
I'm not see any problem if it's work locally with hosts file. In real life no difference because host file replace DNS records in real world. Point your real domains to same IP address. Easy for support future domains point .com to IP address and in other domains add CNAME to .com domain. In this case if your IP address was changed you need change only DNS records in .com domain.
First, you need to get the public IP address of your hosted GoDaddy server. Next, you need to select 'Use other host' and enter that public IP address as the IP address for your 'pl' domain name.
After you have done this, you must go into your hosted GoDaddy server, and run IIS Manager. How you proceed will depend on whether the hosted server is running IIS 6, or IIS 7+.
For IIS6, you would select your site, right-click and choose 'Properties', make sure the 'Web Site' tab is selected, then you would click the 'Advanced' button next to the 'IP address' box. In the 'Advanced Web Site Identification' window, in the 'Multiple identities for this Web site' section, you would click 'Add', enter 80 for the TCP port, and enter your .pl domain name in the 'Host header value' box. Click 'OK' to close each window, until you are back at the main IIS Manager window.
For IIS7+, you can follow the directions at http://technet.microsoft.com/en-us/library/cc731692(WS.10).aspx
Once you have added the binding for your 'pl' domain name on the hosted server, and after the DNS change to point your 'pl' domain name to the hosted server propagates, everything should work as it did on your development server.
counsellorben
You need to point the .pl name to your site at .com.
You do this with a CNAME record at www.mydomain.pl pointing to www.mydomain.com.
Don't forget the period at the end. It's important in CNAME-records.
Ok, finally got it working. this is my solution (counsellorben pointed me in the right direction to get this solved)
Solution:
1) Log on to your godaddy account -> my products -> domain manager -> DNS manager -> you will get a list of your domains.
On top you will notice 3 buttons: "Renew", "Upgrade", "Offsite". Click "Offsite" -> Add new Off-site -> for domain name enter your domain name purchased at third party domain service (in my case it was: "myawesomedomain.pl"). DO NOT check off "This domain will be transferred if you do not want it transferred (currently godaddy doesn't support European domains).
In the popup box you will also notice two nameservers listed. Write these down for later step.
Nameservers:
mns01.domaincontrol.com
mns02.domaincontrol.com
Once you've created an off-site domain click on "Edit zone" link below it. Once there enter the following info:
A (Host): Host: @ | Points to: IP address of your .COM domain/hosted by godaddy (myawesomedomain.com)
CNAME (Alias): Host: www | Points to: @
2) While still on godaddys website go to "My products" -> Hosting -> click on your '.COM' hosting service -> Launch -> You should be in "Hosting dashboard":
Click on "settings" -> Domain Management -> click "Add Domain" and enter your european domain name (in my case it was "myawesomedomain.pl"). So now in domain manager I would see two domains listed:
- myawesomedomain.com
- myawesomedomain.pl (newly added domain)
3) Now log in to your third party domain service and point your domain (in my case 'myawesomedomain.pl') to godaddy's default hosting nameservers. In my case I had to log in to home.pl -> configure domain -> "Use external DNS server". Enter the following for DNS1 and DNS2:
a. mns01.domaincontrol.com b. mns02.domaincontrol.com
The change should propagate within 24 hours. Thanks
精彩评论