虚拟主机重定向到localhost

时间:2017-12-21 04:06:09

标签: apache xampp

使用XAMMP创建虚拟主机时遇到问题。虚拟主机始终重定向到localhost。例如,当我键入mysite.local将重定向到localhost / mysite。下面是我的主机和apache配置:

  1. etc / hosts

    127.0.0.1       localhost
    255.255.255.255 broadcasthost
    ::1             localhost
    fe80::1%lo0     localhost
    127.0.0.1       mysite.local
    
  2. /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf

    NameVirtualHost *:80
    # localhost
    <VirtualHost *:80>
      ServerName localhost
      DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    </VirtualHost> 
    <VirtualHost *:80>
      ServerName mysite.local
      ServerAlias mysite.local *.lancome.local
      DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/mysite"
      <Directory "/Applications/XAMPP/xamppfiles/htdocs/mysite">
        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride All
        Require all granted
      </Directory>
    </VirtualHost>
    

1 个答案:

答案 0 :(得分:0)

1)D:\ xampp \ apache \ conf \ extra \ httpd-vhosts.conf

$stmt = $linkID1->prepare("select slno,video_url,views,downloads from VideoUploads");
    $stmt->execute();
    $stmt->bind_result($slno,$video_url,$views,$downloads);
    $stmt->fetch();
    $stmt->close();

2)C:\ Windows \ System32 \ drivers \ etc

<VirtualHost *:80>
 DocumentRoot "D:/xampp/htdocs/webshop_moscow/trunk"
 ServerName bos.webshop.local
 <Directory "D:/xampp/htdocs/webshop_moscow/trunk">
  # Order allow,deny
  # Allow from all
  Require all granted
 </Directory>
</VirtualHost>