Solved

Redirect sub domain to another website?

Posted on 2013-01-08
4
707 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
4 Comments
 
LVL 20

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 39

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 500 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you have a multi-homed DNS setup in windows, you can have issues with connectivity to the server that hosts the DNS services (or even member servers of your domain if this same DNS server is a DC). This is because windows registers all of its IPs…
I've written instructions for one router type, but this principle may be useful for others of the same brand and even other brands of router. Problem: I had an issue especially with mobile devices that refused to use DNS information supplied via…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now