How to remove “web/app_dev.php” from Symfony2 URLs?

前端 未结 7 1172
误落风尘
误落风尘 2020-12-13 07:01

I just created my first Symfony2 project. But the \"/web/app_dev.php\" part in the URL annoys me. It should be possible to do this without Virtual hosts...

7条回答
  •  误落风尘
    2020-12-13 07:41

    If you use an apache virtual host, you can get it working the way you desire. Here is an example virtual host from my xampp:

    
        ServerName myurl.local
    
        # Basic stuff
        DocumentRoot "C:/path/to/symfony/web"
        DirectoryIndex app.php
        
            AllowOverride All
            Allow from All
        
    
    

    After restarting your apache, you can access the project through http://myurl.local (don't forget to configure your hosts file under C:\Windows\system32\drivers\etc\hosts!). If you want to have the dev environment (app_dev.php) not showing up in the url, change the DirectoryIndex to app_dev.php.

提交回复
热议问题