如何摆脱沼泽中拉拉韦尔的公共道路 [英] How to get rid of the public path in laravel on wamp

查看:95
本文介绍了如何摆脱沼泽中拉拉韦尔的公共道路的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个快速问题.我正在尝试第一次使用Laravel.为此,我正在使用Wamp.而且我不知道这是否重要,但是我在以下地址设置了wamp的DocumentRoot:

I have a quick issue. I am trying to use Laravel for the first time. To do so, I'm using Wamp. And I don't know if this is important, but I set the DocumentRoot of wamp at this address :

DocumentRoot "C:\Users\Bebop\Documents\Site Internet/"

我在名为Sites的文件夹中对许多其他网站使用了wamp.当我访问其中一个站点时,我将转到:localhost/Sites/thewebsite.因此,我真正想要的只是摆脱Laravel网站路径中的公用文件夹.

I using wamp for a lot of different websites in a folder called Sites. When I access to one of the site I go to : localhost/Sites/thewebsite. So really what I want is just to get rid of the public folder in the path to the Laravel website.

目前我已经完成了:

  • 将apache的httpd.conf更改为包括vhosts.conf:

  • Change httpd.conf of apache to include vhosts.conf :

包含conf/extra/httpd-vhosts.conf

Include conf/extra/httpd-vhosts.conf

创建了一个新的虚拟主机,并按如下所示配置了目录:

Created a new Virtual hosts and configured the directory like so :

DocumentRoot"C:/用户/Bebop/文档/站点Internet/站点/LaravelTest/公共" ServerName网站/LaravelTest

DocumentRoot "C:/Users/Bebop/Documents/Site Internet/Sites/LaravelTest/public" ServerName Sites/LaravelTest

选项索引FollowSymLinks 允许全部覆盖 拒绝订单,允许 全部拒绝 允许从127.0.0.1起

Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Deny from all Allow from 127.0.0.1

之后,我在C:\ Windows \ System32 \ drivers \ etc中的文件中添加了新主机

After that I added a new host in the file located at C:\Windows\System32\drivers\etc

127.0.0.1       localhost
127.0.0.1       Sites/LaravelTest

这样做,当我进入本地主机时,我被重定向到Laravel网站.但是我想转到localhost/Sites/LaravelTest,因为现在我无法访问所有其他网站.

By doing this, when I go to localhost I get redirected to the Laravel websites. But I would like to go to localhost/Sites/LaravelTest, because now I can't access to all my other websites.

有人知道怎么做吗?

非常感谢您的帮助

推荐答案

假设您要访问Laravel网站,网址为:http://localhost/LaravelSite/

Assuming that you want to reach your Laravel site at: http://localhost/LaravelSite/

您可以在httpd.conf文件中使用别名:

You can either use an alias in your httpd.conf file:

Alias /LaravelSite/ "C:/Users/Bebop/Documents/Site Internet/Sites/LaravelTest/public/"
<Directory "C:/Users/Bebop/Documents/Site Internet/Sites/LaravelTest/public">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

或在命令提示符下使用以下命令创建符号链接:

or, create a symbolic link under command-prompt with the following:

mklink /D "C:\Users\Bebop\Documents\Site Internet\Sites\LaravelSite" "C:\Users\Bebop\Documents\Site Internet\Sites\LaravelTest\public"`

这篇关于如何摆脱沼泽中拉拉韦尔的公共道路的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆