1

I use WampServer in order to test my sites locally. I'm reorganizing my development environment and I faced this issue:

I want to have multiple folders inside the root www folder of WampServer. Each subfolder represents one site.

My problem now is that every relative link that starts with / is not working, since it takes localhost as the root instead of localhost/subfolder/. For example:

  • <a href="/">...
  • <img src="/images/...

Also, every site has its own .htaccess file and inside I use RewriteBase /. Now, this line breaks all my RewriteRules since takes /subfolder/ as part of the URL.

My only idea to solve this is by using virtual hosts for every site, so instead of having localhost/subfolder/, I will have something like subfolder.dev.

Changing relative links or .htaccess files of all my existing sites is not an option. Virtual hosts seems to be what I need, but it requires modifying conf/extra/httpd-vhosts.conf and c:\windows\system32\drivers\etc\hosts every time I add a new site.

Is there any other way to configure my WampServer (Apache) to work in the way I need?

Update: I just finish to configure Virtual hosts for all my sites and everything works perfect. So, I leave the question open in case there exists an easier solution.

By the way, how does paid hostings deal with multiple domains under one customer account? Do they use Virtual hosts too?

Community
  • 1
  • 1
IvanRF
  • 7,115
  • 5
  • 47
  • 71
  • 1
    You have picked the correct solution i.e. Virtual Hosts. There is no automated way to do this, but once you have done it for a few sites its just a copy/paste and change a few folder names and the ServerName and DocumentRoot and add a HOSTS definition. So its not a big deal – RiggsFolly Aug 14 '14 at 23:35
  • @RiggsFolly thanks for your comment! at least now I know that I'm in the right direction :) – IvanRF Aug 14 '14 at 23:52
  • I believe hosting companies use something like Virtual Hosts but not necessarily exactly like you and I do it. – RiggsFolly Aug 16 '14 at 13:31
  • @RiggsFolly you seem reliable, have you deal with this: [Reuse PHP project in Eclipse / Aptana Studio 3](http://stackoverflow.com/questions/25344771/reuse-php-project-in-eclipse-aptana-studio-3)? – IvanRF Aug 16 '14 at 23:15

0 Answers0