Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Redirect sub domain to another website?

Posted on 2013-01-08
4
Medium Priority
?
727 Views
Last Modified: 2013-01-11
Hi,
I have a Windows 7 hosts file below that is being ignored/bypassed when I connect to the interent via a 3G moderm which uses a proxy server.

C:\Windows\System32\drivers\etc\hosts

123.456.56.232            www.mywebsite.com
123.456.56.232            mywebsite.com
123.456.56.232            www.otherwebsite.com
123.456.56.232            otherwebsite.com

Basically I use the host file to test/build websites on new hosting accounts before moving them there.
I can't use the host file and if I try cpanel temp link http://123.456.56.232/~mywebsite the website layout is not correct.

If I created a subdomain from another domain I own (say redirect.com) could I point a sub domain to this test site by creating a DSN record at my registrar to point to the test site?

For example something like
mywebsite.redirect.com --> www.mywebsite.com @ 123.456.56.232
otherweb.redirect.com --> www.otherwebsite.com @ 123.456.56.232

If so how would I do it, any ideas or suggestions would be appreciated.

Thanks
0
Comment
Question by:sabecs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 21

Expert Comment

by:netcmh
ID: 38757329
Both websites in your hosts file point to the same IP address. That could be your problem.

You could do a subdomain, a php script or anything else to redirect.
0
 
LVL 41

Expert Comment

by:footech
ID: 38757371
You can create any entries in DNS to point at a particular IP.  So if you own "redirect.com", create an A record for "website1" in that domain, and point it at the IP that you want.  But remember, this only resolves an IP.  If your website is relying on a GET request for a particular URL (e.g. www.website.com), a request to website1.redirect.com, even if it returns the same IP as www.website.com, will not get the right content.  The same is true if you created CNAME records in place of A records (a CNAME references another FQDN, vs. an A record which references an IP).
0
 

Author Comment

by:sabecs
ID: 38757701
Thanks for the feedback. In that case does anyone know how to bypass a proxy server, perhaps using another dns service provider?
0
 
LVL 11

Accepted Solution

by:
RedLondon earned 2000 total points
ID: 38757996
Rather than using the hosts file on your PC to trick it into seeing something that's not really there, why not create the development site's account as dev.mydomain.com.  That way you bypass the need to bypass the proxy (and the need to have the hosts file at all)

If you have access to WHM and you're developing on the same server as the live website lives, you just create a new account as normal and specify dev.mydomain.com as the hostname - it'll be handled completely seperately from mydomain.com's actual hosting account.  You can then upload to, and view files on, dev.mydomain.com without further changes.

If you're not developing on the same server as the live website uses, create the new account dev.mydomain.com on the development server, and then create a subdomain on the live site's server as you did before, giving the development server's IP address.

This way, provided you don't hardcode the hostname dev.mydomain.com or its home directory path anywhere, then your development will work when you go live by copying it to www.mydomain.com in its original place.  If you do hardcode the home directory path or the hostname anywhere, you can just search/replace for it at the end.
0

Featured Post

Looking for the Wi-Fi vendor that's right for you?

We know how difficult it can be to evaluate Wi-Fi vendors, so we created this helpful Wi-Fi Buyer's Guide to help you find the Wi-Fi vendor that's right for your business! Download the guide and get started on our checklist today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how a domain name may be inadvertently appended to all DNS queries. This exhibits as described below. (CODE)And / Or: (CODE) Cause This issue can occur in either of these two scenarios. EITHER 1. A Primary DNS S…
There have been a lot of times when we have seen the need to enter a large number of DNS entries in a forward lookup zone. The standard procedure would be to launch the DNS Manager console, create the Zone and start adding new hosts using the New…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question