【问题标题】:IIS Joomla! URL rewriteIIS Joomla!网址重写
【发布时间】:2013-01-06 16:59:18
【问题描述】:

我在我的 IIS 服务器中配置了 Joomla。

我想为我的应用程序添加一个自定义的 SEO 友好 URL,我使用 apache 更正了这个问题并且工作正常。但我是 ISS 的新手,对重写 URL 有疑问。

我在 Joomla! 中启用了 url 重写选项!并创建了一个像这样的干净网址

http://www.sitename.com/shop?shop=3

我的要求是

当前网址:http://www.sitename.com/shop?shop=3(使用店铺PK 3获取数据)

我想改写成

http://www.sitename.com/shop/3/shop-seo-name

当用户单击此链接时,我需要转到 shop-component/shop-view 然后使用 PK 3 获取数据

我有代码要在这里重写

<rule name="MyRule">
  <match url="^shop?shop=[0-9A-Z]" />
  <action type="Rewrite" url="index.php" />
</rule>

但这不起作用 有什么想法吗?

【问题讨论】:

    标签: iis joomla url-rewriting web-config


    【解决方案1】:

    您需要对查询字符串使用条件,如下所示:

    <rule name="MyRule">
        <match url="^shop" />
        <conditions>
            <add input="{QUERY_STRING}" pattern="^shop=([0-9A-Z]+)$" />
        </conditions>
        <action type="Rewrite" url="index.php" />
    </rule>
    

    【讨论】:

    • 感谢您的评论..以及如何将“shop”变量传递给 index.php ?这样我就可以获取数据了
    猜你喜欢
    • 1970-01-01
    • 2014-05-14
    • 2013-02-27
    • 1970-01-01
    • 2016-05-21
    • 2010-10-08
    • 2018-07-31
    • 1970-01-01
    相关资源
    最近更新 更多