如何将 ngrok 用于 localhost 的子文件夹

问题描述

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

localhost
  --wordpress

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

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

解决方法

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

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

enter image description here