Url rewriting 如何在lucee中实现URLRewite

Url rewriting 如何在lucee中实现URLRewite,url-rewriting,coldfusion,lucee,Url Rewriting,Coldfusion,Lucee,我想在我的lucee应用程序中重写url。我使用url来显示视图页面,我希望它显示为。这不会在Lucee中实现,而是在web服务器中实现,例如Apache、IIS、Nginx等。。。Lucee是一个运行在Tomcat等应用服务器上的servlet,而不是web服务器,不要将二者混为一谈。这不会在Lucee中实现,而是在web服务器上实现,例如Apache、IIS、Nginx等。。。Lucee是一个运行在Tomcat等应用服务器上的servlet,而不是web服务器,不要将两者混为一谈。如前所述,

我想在我的lucee应用程序中重写url。我使用url来显示视图页面,我希望它显示为。

这不会在Lucee中实现,而是在web服务器中实现,例如Apache、IIS、Nginx等。。。Lucee是一个运行在Tomcat等应用服务器上的servlet,而不是web服务器,不要将二者混为一谈。

这不会在Lucee中实现,而是在web服务器上实现,例如Apache、IIS、Nginx等。。。Lucee是一个运行在Tomcat等应用服务器上的servlet,而不是web服务器,不要将两者混为一谈。

如前所述,这取决于web服务器,尤其是在生产环境中。但是,在某些情况下,在开发中,您可能希望在servlet容器引擎中使用URLEWRITE,而不使用前端Web服务器。阅读您的帖子,您使用的是8888端口,这使我假设您使用的是Lucees默认的servlet容器Tomcat

因为Tomcat8.0,所以可以使用URLRewite。但正如前面所说的,这只建议用于开发或将Tomcat作为独立产品。如果您在Tomcat前面有另一个Web服务器,那么您可以让该设置保持不变,前面的Web服务器将执行url重写。对于独立使用Tomcat的工作解决方案,添加RewriteValve和包含url重写规则的rewrite.config文件,如下所示:

编辑{path_to_lucee}/conf/server.xml,并将RewriteValve指令添加到脚本主体中。那就是: 重新启动Tomcat以使新设置生效 你很可能不得不调整这个规则。有关更多和更深入的信息,请参阅:

如前所述,这取决于Web服务器,尤其是在生产中。但是,在某些情况下,在开发中,您可能希望在servlet容器引擎中使用URLEWRITE,而不使用前端Web服务器。阅读您的帖子,您使用的是8888端口,这使我假设您使用的是Lucees默认的servlet容器Tomcat

因为Tomcat8.0,所以可以使用URLRewite。但正如前面所说的,这只建议用于开发或将Tomcat作为独立产品。如果您在Tomcat前面有另一个Web服务器,那么您可以让该设置保持不变,前面的Web服务器将执行url重写。对于独立使用Tomcat的工作解决方案,添加RewriteValve和包含url重写规则的rewrite.config文件,如下所示:

编辑{path_to_lucee}/conf/server.xml,并将RewriteValve指令添加到脚本主体中。那就是: 重新启动Tomcat以使新设置生效 你很可能不得不调整这个规则。有关更多和更深入的信息,请参阅:
您是否在Windows上使用IIS?如果是这样的话,你所需要的就是

安装它,用重写规则设置web.config,就可以开始了

您可能也不希望在URL中使用.cfm扩展名。我使用此规则:

<rule name="Rewrite .cfm" enabled="true" stopProcessing="false">
          <match url="[^?]*" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).png" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).cfm" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).cfc" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).jpg" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).gif" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).mp4" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).mp3" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).css" negate="true" />
          </conditions>
          <action type="Rewrite" url="{R:0}.cfm" />
        </rule>

您必须为您的网站支持的所有文件类型(如.mkv或.js)添加更多条件。您是否在Windows上使用IIS?如果是这样的话,你所需要的就是

安装它,用重写规则设置web.config,就可以开始了

您可能也不希望在URL中使用.cfm扩展名。我使用此规则:

<rule name="Rewrite .cfm" enabled="true" stopProcessing="false">
          <match url="[^?]*" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).png" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).cfm" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).cfc" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).jpg" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).gif" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).mp4" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).mp3" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).css" negate="true" />
          </conditions>
          <action type="Rewrite" url="{R:0}.cfm" />
        </rule>
您必须为网站支持的所有文件类型(如.mkv或.js)添加更多条件

<rule name="Rewrite .cfm" enabled="true" stopProcessing="false">
          <match url="[^?]*" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).png" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).cfm" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).cfc" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).jpg" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).gif" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).mp4" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).mp3" negate="true" />
            <add input="{REQUEST_FILENAME}" pattern="^(.*).css" negate="true" />
          </conditions>
          <action type="Rewrite" url="{R:0}.cfm" />
        </rule>