Symfony 2 on virtual hosts

不打扰是莪最后的温柔 提交于 2019-11-27 20:16:18

You are using the virtualhost configuration proposed for Symfony 1.

My virtualhost for Symfony2 under linux looks like this:

<VirtualHost *:80>
    ServerName www.domain.com.localhost
    ServerAlias domain.com.localhost
    ServerAdmin webmaster@localhost

    DocumentRoot /home/user/www/project/web
    <Directory /home/user/www/project/web/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ /app.php [QSA,L]
        </IfModule>
    </Directory>
</VirtualHost>

Try this (adapted to your config in windows), restart Apache, and try accessing the URL again.

You will find more informations on Symfony2 virtual hosts on this cookbook entry.

Windows version for symphony 3.4:
Just simple like this:

C:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
  DocumentRoot "C:/xampp/htdocs/symphony_CRUD/web"
  DirectoryIndex app_dev.php
  ServerName fudu.symphony.net
</VirtualHost>

C:\Windows\System32\drivers\etc

127.0.0.1 fudu.symphony.net

Then you go fudu.symphony.net/app_dev.php
Hope it help some one :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!