laravel 在虚拟 wamp 主机上
laravel on virtual wamp host
我已经使用 Composer 创建了一个新的 Laravel 5.2 项目。然后我将所有 Laravel 文件夹移动到一个名为 local 的新文件夹中,public 文件夹除外。我已将 public 文件夹中的文件放在文档根目录中。这是为了从 url 中删除“public”。所以我在一些教程中找到了。现在,我可以通过键入 http://mysite 来调用我的 wamp 服务器上的站点。
到目前为止一切顺利。但是,我在下面设置的导航不起作用。
<a href="<?php echo URL::to('/info')?>">{{ trans('navcontent.info') }}</a>
也没有
<a href="mysite/info">{{ trans('navcontent.info') }}</a>
相反,localhost returns 错误:“在此服务器上找不到请求的 URL /info”
我需要在 Laravel 中配置什么才能使其正常工作?
它适用于 xamp。 httpd-vhosts.conf 设置:
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs"
ServerName localhost
ServerAlias localhost
<Directory "D:/xampp/htdoc">
AllowOverride All
Require local
</Directory>
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/mysite"
ServerName mysite
<Directory "D:/xampp/htdocs/mysite">
AllowOverride All
Require local
</Directory>
除 public 文件外,所有 Laravel 内容都存储在本地文件夹中。 public 文件夹中的文件现在位于根文件夹中。
转到 "C:/wamp/bin/apache/Apache2.2.21/conf/extra" 并打开文件 "httpd.vhosts.conf"。它应该是这样的:
<VirtualHost *:80>
ServerName mysite
ServerAlias mysite
ServerAdmin webmaster@mysite
DocumentRoot "C:/xampp/htdocs/mystie/public"
<Directory "C:/xampp/htdocs/mysite/public">
AllowOverride All
Require local
</Directory>
</VirtualHost>
在你刚刚添加的目录代码之后,
更好
<a href="{{ url('/info') }}">{{ trans('navcontent.info') }}</a>
我已经使用 Composer 创建了一个新的 Laravel 5.2 项目。然后我将所有 Laravel 文件夹移动到一个名为 local 的新文件夹中,public 文件夹除外。我已将 public 文件夹中的文件放在文档根目录中。这是为了从 url 中删除“public”。所以我在一些教程中找到了。现在,我可以通过键入 http://mysite 来调用我的 wamp 服务器上的站点。
到目前为止一切顺利。但是,我在下面设置的导航不起作用。
<a href="<?php echo URL::to('/info')?>">{{ trans('navcontent.info') }}</a>
也没有
<a href="mysite/info">{{ trans('navcontent.info') }}</a>
相反,localhost returns 错误:“在此服务器上找不到请求的 URL /info”
我需要在 Laravel 中配置什么才能使其正常工作?
它适用于 xamp。 httpd-vhosts.conf 设置:
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs"
ServerName localhost
ServerAlias localhost
<Directory "D:/xampp/htdoc">
AllowOverride All
Require local
</Directory>
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/mysite"
ServerName mysite
<Directory "D:/xampp/htdocs/mysite">
AllowOverride All
Require local
</Directory>
除 public 文件外,所有 Laravel 内容都存储在本地文件夹中。 public 文件夹中的文件现在位于根文件夹中。
转到 "C:/wamp/bin/apache/Apache2.2.21/conf/extra" 并打开文件 "httpd.vhosts.conf"。它应该是这样的:
<VirtualHost *:80>
ServerName mysite
ServerAlias mysite
ServerAdmin webmaster@mysite
DocumentRoot "C:/xampp/htdocs/mystie/public"
<Directory "C:/xampp/htdocs/mysite/public">
AllowOverride All
Require local
</Directory>
</VirtualHost>
在你刚刚添加的目录代码之后, 更好
<a href="{{ url('/info') }}">{{ trans('navcontent.info') }}</a>