简体   繁体   中英

Symfony Vhost is not working?

I am using XAMPP in Windows.I want to set vhost for my symfony project so I have set the vhost in apache through (httpd-vhosts.conf) file as :

# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:80

# This is the configuration for drberg.com
Listen 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
  ServerName drberg.com.local
  DocumentRoot "D:/xampp/htdocs/DrBerg.com/web"
  DirectoryIndex index.php
  <Directory "D:/xampp/htdocs/DrBerg.com/web">
    AllowOverride All
    Allow from All
  </Directory>

  Alias /sf "D:/xampp/htdocs/DrBerg.com/web/sf"
  <Directory "D:/xampp/htdocs/DrBerg.com/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

So I can't access it it's not opening anything also when I access my symfony project through manual link so it redirects me to my localhost as :

http://localhost/DrBerg.com/web/

So it redirects me to :

http://localhost/xampp/

Set in your hosts (in WINDOWS/system32/drivers/etc/) your ServerName :

127.0.0.1        drberg.com.local

(it works immediately after save this file)

and point to:

http://drberg.com.local

(use http:// because sometimes chrome send the address to google.com instead go there)

and don't use localhost in the ServerName because XAMPP filter this word ( local can be).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM