首页 > 解决方案 > 如何将 ngrok 用于 localhost 的子文件夹

问题描述

我想使用 ngrok 在 IIS 中显示一个网站,该网站不在默认网站(http://localhost)中,而是在一个子文件夹中作为 IIS 中的应用程序,如下所示......

localhost
  --wordpress

在本地浏览时,我可以像 http://localhost/wordpress/ 一样访问该站点

我如何使用 ngrok 指向这个文件夹,我唯一要做的就是ngrok http 80 只显示默认网站(localhost)的内容,这不是我想要显示的,我想公开 localhost/wordpress文件夹。可以这样做吗?

标签: iisngrok

解决方案


您可以使用 URL Rewrite 将http://localhost/重写为http://localhost/wordpress/

       <rewrite>
            <rules>
                <rule name="Test">
                    <match url="(.*)" />
                    <action type="Rewrite" url="/wordpress/{URL}" />
                </rule>
            </rules>
        </rewrite>

在此处输入图像描述


推荐阅读