dongxun5349 2017-09-19 08:05
浏览 80
已采纳

EasyPHP - localhost别名

I'm using the latest version of EasyPHP on Windows 10 and I would like to achieve one thing which I cannot find an answer to.

I achieve my projects for example like localhost/myproject. Everything is working but it's kind of annoying because my browser's (Google Chrome) autocomplete is kind of useless when all my projects start with localhost

I would like to achieve (probably through Apache config) the thing that when I type for example myproject.dev in my browser it shows me project localhost/myproject. Redirect would be enough but if it worked on the domain the whole time like it does on regular server that would be perfect. So basically I need something like ngrok but with custom domains and it does not need to be public.

It does not need to be automatic, I'm OK with setting each domain manually.

  • 写回答

2条回答 默认 最新

  • dougang6178 2017-09-19 08:11
    关注

    This can be easily achieved.

    First add a new line inside hosts file, located at C:\Windows\System32\drivers\etc:

    127.0.0.1       myproject.dev
    

    Then locate httpd-vhosts.conf or httpd.conf and near the end add:

    <VirtualHost myproject.dev>
        DocumentRoot "path/to/folder/myproject"
        ServerName myproject.dev
        ServerAlias myproject.dev
        <Directory "path/to/folder/myproject">
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题