0

I have some very basic question about Symfony and VirtualHost.

I have my Symfony3 installed in E:/XAMPP/htdocs/icp

Everywhere i read, to setup VirtualHost, so I did it

<VirtualHost *:80>    
DocumentRoot "E:/XAMPP/htdocs/icp/web/app_dev.php"
ServerName icp.com 

When I now call icp.com in the browser, the project renders, but in the background the browser can't find the referenced CSS-files (no-route error).

When I delete the VirtualHost-entry and call the project via localhost/icp/web/app_dev.php, everything works finde.

My question now is, do I really need VirtualHost for local development? If not, how would I call a route/controller(?),.. i.e. ipc.com/mycontroller/mymethod/3 without VirtualHost??

Further there is the question, what did I wrong with my VirtualHost-config ??

JohnPoe
  • 61
  • 8
  • 1
    [Read the manual](https://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html) – kero Jul 09 '16 at 09:54

1 Answers1

2

Do I really need VirtualHost for local development?

It all depends on personal preference, if you want to open project with virtual host you can configure it like this if not keep like this localhost/icp/web/app_dev.php.


What did I wrong with my VirtualHost-config ??

You have issue in following line,

DocumentRoot "E:/XAMPP/htdocs/icp/web/app_dev.php"

DocumentRoot should not be pointing to file, instead it should point to web folder. Like this,

DocumentRoot "E:/XAMPP/htdocs/icp/web/"
Alok Patel
  • 7,842
  • 5
  • 31
  • 47
  • Hey thank you very much :) .. after weeks of trying it finally works, but some of my work suddenly doesn't work.. what's about, wenn I would not like to use VHosts. How would I call a url mentioned in the question? .. further, how would I need to configure it, so i get the **dev** ? – JohnPoe Jul 09 '16 at 10:03
  • You can configure it in `.htaccess` file placed in web folder. – Alok Patel Jul 09 '16 at 10:10