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条)

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?