Forum Moderators: phranque
Rather than editing the host files on the other network pc's, I've installed bind9 to handle local dns, and to act as a caching internet dns for all the other pc's.
At the moment for each live site, hosted elsewhere, I have a local development site named 'local-domainname.tld'.
This means if I want to use absolute URL's I have to manually rewrite the links as follows:
www.local-domain.tld/folder/file --> www.domain.tld/folder/file
Is there a way to configure my local server to accept URL's without the 'local-' part but still link to the local page?
I can think of two ways you may be able to do this:
1) mod_proxy:
I've never used mod_proxy, so I have no idea if this will actually work, but I think you could do something like this:
ProxyRequests On
ProxyRemote http://domain.tld http://local-domain.tld
You would then have to configure your browser's proxy settings to point to that server. If you didn't want everyone on your network affected, this would work well.
2) Assuming your network is using one of the private IP blocks - 192.168.x.x or 10.x.x.x - then you could set the DNS for each site to a unique IP address, and configure Apache for IP-based virtual hosting. It would then respond whether the domain was domain.tld or local-domain.tld. You also have to configure linux to listen to each of those IP addresses, but this isn't too difficult in the grand scheme of things. This would effect everyone on your network, assuming they use the same DNS servers.
Let me know if I stopped making sense at any point, I tend to do that :) Good luck!
Chad
At the moment for each website I have two versions!
On my development server "local-mywebsite.tld" which is only visible to pc's on my local network, and a corresponding "mywebsite.tld" with my hosting company.
I'm trying to get rid of the "local-" bit of the URL's so I can have just have one copy of each site.
So far I've found two possible solutions:
1) Use relative addressing i.e /.../.../filename addressing everything relative to the root. I not keen on this.
2) Put the 'local-mywebsite' or 'mywebsite' bit of the URL's into a php variable and set it accordingly.
This must be a common problem, I'm wondering how other people have worked round it?
RewriteRule ^old_URL$ http://%{HTTP_HOST}/new_URL [R=301,L]
[edit] De-linked [/edit]
[edited by: jdMorgan at 4:33 pm (utc) on Mar. 6, 2006]
As someone used to windows servers and IIS it's amazing the power and flexibility available with Apache. Not to mention the price, I have built a complete 'production spec' web server to play with, and haven't spent a penny on software or licencing.
I've only been experimenting with linux and Apache since January, but I can already see that I'll be leaving my Windows/IIS hosting company very soon!