【问题标题】:Virtual host is redirect to localhost虚拟主机被重定向到本地主机
【发布时间】:2018-06-03 16:59:17
【问题描述】:

我无法使用 XAMMP 创建虚拟主机。虚拟主机总是重定向到 localhost。例如,当我键入 mysite.local 时,将重定向到 localhost/mysite。以下是我的主机和 apache 配置:

  1. 等/主机

    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>
    

【问题讨论】:

  • /mysite 文件夹中有.htaccess 文件?
  • 是的,我在 /mysite 文件夹中有 .htaccess。这是 magento 2 项目

标签: apache xampp


【解决方案1】:

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

<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>

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

127.0.0.1       bos.webshop.local

【讨论】:

    猜你喜欢
    • 2012-03-29
    • 2015-08-16
    • 2014-02-17
    • 1970-01-01
    • 2012-05-03
    • 2012-02-06
    • 1970-01-01
    • 2018-06-26
    • 2012-08-18
    相关资源
    最近更新 更多