I have to manage a few websites. For testing I have a local (localhost) copy and an online copy.
The cms engine http://Pyrocms.com has a multi-site manager and you enter a domain. In the browser you enter the domain name and it serves the website for the request site that is stored in a central database.
Online this works fine but locally it doesn’t, I end up having to type
localhost/silo1/myclient1/
I would like to be able to type
myclient1.test
The first thing I thought of was lmhost file, but I releasise I cant map to the sub directories, just the IP addresses.
Below is what I tried to do in the host file in Windows7, it didnt work, it just directed me to 127.0.0.1 when I entered mywebsite2.test.
HOST FILE – AKA LMHOST
File stored @ #C:\Windows\System32\drivers\etc
lmhost/host file
127.0.0.1 mywebsite1.test
127.0.0.1/mywebsite2/ mywebsite2.test **#I want to do something like this**
Technologies:
-
OS: Windows7 Server: WAMP 2
-
(Apache with Mod Rewrite on)
If I understand you correctly, the only way you are going to accomplish that is by…
Editing the HOSTS file (not LMHOSTS) to resolving your fake domain-name to the loopback address (127.0.0.1).
Then use an .htaccess file with mod_rewrite conditions and rules to match the host header (for each different website) and internally rewrite the request to the proper sub-folder/sub-url.
Or if you want to do a full redirect (instead of an internal redirect)…