PhpStorm Localhost在根目录中 [英] PhpStorm Localhost in root directory

查看:292
本文介绍了PhpStorm Localhost在根目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PhpStorm中运行项目时,将我带到localhost:63342/MyProject/index.php,但这会中断所有链接,因为它将项目名称添加到我的链接工作的URL中,因为在域上它们都是mysite.com/image1.jpg、mysite.com/file2.htm等...

When running a project in PhpStorm it takes me to localhost:63342/MyProject/index.php but this breaks all of the links because it adds the project name to the URL of my links work because on the domain it they are all mysite.com/image1.jpg, mysite.com/file2.htm, etc...

有没有一种方法可以使它作为 http://localhost:63342/index.php 代替 http://localhost:63342/MyProject/index.php .

Is there a way to make it run the project as http://localhost:63342/index.php instead of http://localhost:63342/MyProject/index.php.

我已经尝试了所有我能想到的,但是我似乎无法弄清楚这一点.我一定很想念东西.

I've tried everything I can think of but I can't seem to figure this one out. I must be missing something.

推荐答案

您不能执行http://localhost:63342/index.php-仅执行http://MyProject:63342/index.php(IDE仍需要知道以何种方式提供服务的站点/文件).为此:

You cannot do http://localhost:63342/index.php -- only http://MyProject:63342/index.php (IDE still needs to know what site/files to serve somehow). For that:

  1. 编辑您的hosts文件(或本地DNS服务器,如果需要的话,可以有一个),然后将MyProject指向计算机的IP.

  1. Edit your hosts file (or local DNS server, if preferred and have one) and point MyProject to your computer's IP.

创建正确类型的部署条目(应该执行In Place),对其进行配置(提供所需的URL等-http://MyProject:63342/)并将其标记为默认值此项目-现在,IDE将在生成在浏览器中打开" URL时从那里使用URL.

Create Deployment entry of correct type (In Place should do), configure it (provide desired URL etc -- http://MyProject:63342/) and mark it as Default for this project -- now IDE will use URL from there when generating "open in browser" URLs.

这篇关于PhpStorm Localhost在根目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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