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 如何使用simulink建立一个永磁同步直线电机模型?
  • ¥30 天体光谱图的的绘制并得到星表
  • ¥15 PointNet++的onnx模型只能使用一次
  • ¥20 西南科技大学数字信号处理
  • ¥15 有两个非常“自以为是”烦人的问题急期待大家解决!
  • ¥30 STM32 INMP441无法读取数据
  • ¥15 R语言绘制密度图,一个密度曲线内fill不同颜色如何实现
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗