更改本地主机的基本URL [英] Changing base url of localhost

查看:66
本文介绍了更改本地主机的基本URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习PHP和Laravel.到现在为止,我始终实现前端,而不必做后端,也不必配置apache.我认为我的问题很简单,但是我不知道该如何解决,因为我不知道应该搜索哪个关键字.

I am learning PHP and Laravel. Until now I always implemented frontend and never had to do backend and never had to configure apache. I think my problem is a very easy one but I didn't know how to fix, because I didnt know what keyword I should search for.

我的问题:

我正在实施两个项目.一个叫做LearningLaravel,另一个叫做MyFirstPHPage.在这两个项目中,我都将Laravel用于后端,将Angularjs用于前端,将XAMPP用于Apache.

I am implementing two projects. One is called LearningLaravel and the other one is called MyFirstPHPage. In both projects I am using Laravel for backend, Angularjs for frontend and XAMPP for apache.

我的问题是我想更改两个页面的基本URL.

My problem is that I want to change the base url of both pages.

例如,当我想显示第一个项目的设置视图时,必须转到url

For example when I want to show the settings view of the first project I have to go to the url

localhost/LearningLaravel/resources/views/welcome.blade.php#/settings

localhost/LearningLaravel/resources/views/welcome.blade.php#/settings

,然后转到第二页

localhost/MyFirstPHPage/resources/views/welcome.blade.php#/settings

localhost/MyFirstPHPage/resources/views/welcome.blade.php#/settings

但是我只想输入类似的内容

But I only want to type something like

localhost/LearningLaravel/#/设置

localhost/LearningLaravel/#/settings

localhost:8000/settings

localhost:8000/settings

第一个项目的设置,

localhost/MyFirstPHPage/#/settings

localhost/MyFirstPHPage/#/settings

localhost:8080/settings

localhost:8080/settings

用于第二个项目.我怎样才能做到这一点?链接到教程也可以.

for the second project. How can I achieve this? Links to tutorials would be ok too.

预先感谢

推荐答案

为Laravel项目创建虚拟主机:

<VirtualHost some.app:80>
    DocumentRoot "C:/LaravelProject/public"
    ServerName some.app
    ServerAlias some.app

    <Directory "C:/LaravelProject/public">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

然后将类似于以下内容的内容添加到Windows hosts文件:

Then add to Windows hosts file something like this:

localhost    some.app

重新启动Apache并使用http://some.app/settings代替localhost/MyFirstPHPage/resources/views/welcome.blade.php#/settings

Restart Apache and use http://some.app/settings instead of localhost/MyFirstPHPage/resources/views/welcome.blade.php#/settings

这篇关于更改本地主机的基本URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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