Carsten Posted November 6, 2005 Share Posted November 6, 2005 I have installed Apache and the localhost works fine. I'm pretty blank when it comes to complex system settings, so please post any answers with fool-proof logic Now I need 2 things: 1. Changing my main localhost root folder from c:\apache\htdoc\north to c:\apache\htdoc. Is it enough to edit the httpd.conf file to contain: DocumentRoot "C:/apache/htdocs", or are there other files needed to change? 2. Being able to access different websites on my home computer, using subdirectories like c:/apache/htdocs/north and C:/apache/htdocs/south etc. I've tried everything I could imagine and all I get is the infamous and sickening 404 finger! Please help P.S. I'm using Dreamweaver 2004. If there are special considerations, do enlight me. Carsten Quote Link to comment https://forums.phpfreaks.com/topic/2807-localhost-and-subdomains/ Share on other sites More sharing options...
Carsten Posted November 6, 2005 Author Share Posted November 6, 2005 Yes there is a way and I've found it (I don't usually speak to myself!) Here is the layout. In the httpd.conf file, at the very buttom right before these 2 last lines LoadModule php4_module c:/php/sapi/php4apache.dll AddType application/x-httpd-php .php place this: NameVirtualHost 127.0.0.1 Listen 127.0.0.1:80 <VirtualHost 127.0.0.1> ServerName main.com ServerAlias main DocumentRoot C:/apache/htdocs </VirtualHost> <VirtualHost 127.0.0.1> ServerName website_1.com ServerAlias website_2 DocumentRoot C:/apache/htdocs/website_1 </VirtualHost> <VirtualHost 127.0.0.1> ServerName website_2.com ServerAlias website_2 DocumentRoot C:/apache/htdocs/website_2 </VirtualHost> The first of the three sections must be present before the others, as this sets up the root of the localhost (I guess). The others can just be multiplied for as many times as you have websites in need of care. Remember to stop Apache, and then restart it, for the changes to take effect. And last, for the ones using Dreamweaver: For each new site, set Site Definition like this: Server model: PHP MySQL Access: Local/Network Testing Server Folder: C:\apache\htdocs\website_1\ URL prefix: http://localhost/website_1/ Hope somebody else can have good use of this. It took me about 10 hours of research and too many cigarettes, but that is all behind me now. I'm a happy man. Carsten Quote Link to comment https://forums.phpfreaks.com/topic/2807-localhost-and-subdomains/#findComment-9403 Share on other sites More sharing options...
Guest footballkid4 Posted November 6, 2005 Share Posted November 6, 2005 By using the IP: 127.0.0.1 you are enclosing yourself to localhost access only. Other users who attempt to access your computer won't be able to use the subdomains Quote Link to comment https://forums.phpfreaks.com/topic/2807-localhost-and-subdomains/#findComment-9404 Share on other sites More sharing options...
Carsten Posted November 6, 2005 Author Share Posted November 6, 2005 By using the IP: 127.0.0.1 you are enclosing yourself to localhost access only. Other users who attempt to access your computer won't be able to use the subdomains Yes you're right, and that was also the idea. I'm not running a server myself, and I don't want anyone to access my computer. I just wanted a setup, so I could locally maintain different websites, and then easily upload the from Dreamweaver. If there is a catch in that aspect, do let me know. Carsten Quote Link to comment https://forums.phpfreaks.com/topic/2807-localhost-and-subdomains/#findComment-9407 Share on other sites More sharing options...
Guest footballkid4 Posted November 6, 2005 Share Posted November 6, 2005 Nope . Of course, insetad of loading your PC up with Apache and PHP and scuh, if you were just going to do localhost you could have download EasyPHP from: http://www.easyphp.org Does the same thing Quote Link to comment https://forums.phpfreaks.com/topic/2807-localhost-and-subdomains/#findComment-9428 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.