Php 主机名不适用于Vagrant上的Laravel(Lumen)安装

Php 主机名不适用于Vagrant上的Laravel(Lumen)安装,php,.htaccess,laravel,vagrant,apache2,Php,.htaccess,Laravel,Vagrant,Apache2,我可以通过浏览器中的IP访问Vagrant上的安装,但当我尝试通过自定义主机名访问它时,它会重定向到http://mysite.dev/public并触发404错误 http://192.168.33.10按预期工作 http://mysite.dev重定向到http://mysite.dev/public并在routeRequests.php第443行中抛出404错误:NotFoundHttpException 我在OSX上运行流浪的虚拟机 有什么想法吗?以下是(可能的)相关文件 流浪汉档

我可以通过浏览器中的IP访问Vagrant上的安装,但当我尝试通过自定义主机名访问它时,它会重定向到
http://mysite.dev/public
并触发404错误

  • http://192.168.33.10
    按预期工作
  • http://mysite.dev
    重定向到
    http://mysite.dev/public
    并在routeRequests.php第443行中抛出404错误:
    NotFoundHttpException
我在OSX上运行流浪的虚拟机

有什么想法吗?以下是(可能的)相关文件

流浪汉档案

Vagrant.configure("2") do |config|

    config.vm.box = "scotch/box"
    config.vm.network "private_network", ip: "192.168.33.10"
    config.vm.hostname = "scotchbox"
    config.vm.synced_folder "~/Documents/projects/mysite", "/var/www", :mount_options => ["dmode=777", "fmode=666"]

end
/private/etc/hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
192.168.33.10   mysite.dev
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

</IfModule>
/my\u site/public/.htaccess

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
192.168.33.10   mysite.dev
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

</IfModule>

选项-多视图
重新启动发动机
#如果不是文件夹,则重定向尾部斜杠。。。
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)/$/$1[L,R=301]
#处理前控制器。。。
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]

感谢您的帮助:)谢谢

试试
http://mysite.dev
为什么mysite.local甚至可以工作-您没有将其放入主机文件中?:)哎呀那只是我问题中的一个输入错误!尽管如此,还是要感谢你的理智检查。我已编辑了问题。请尝试
http://mysite.dev
为什么mysite.local甚至可以工作-您没有将其放入主机文件中?:)哎呀那只是我问题中的一个输入错误!尽管如此,还是要感谢你的理智检查。我已经编辑了这个问题。