簡體   English   中英

使用Episerver平台將子目錄重寫為URL字符串

[英]Rewrite Subdirectory to URL String with Episerver Platform

我需要創建一個規則,通過將“ /”替換為“-”,將子目錄更改為部分URL字符串。 產品ID號已添加到所有URL的末尾,以避免重復的URL,但不應位於其自己的文件夾中。 該平台是Episerver。 這是一個例子:

www.example.com/products/blue-toy/2324

www.example.com/products/hair-spray/3374

www.example.com/products/blue-toy-2324

www.example.com/products/hair-spray-3374

您可以在根.htaccess中將此規則用作第一條規則:

RewriteEngine On

RewriteRule ^(products)/([^/]+)/([0-9]+)/?$ /$1/$2-$3 [L,NC,R=302]

如果使用的是.NET CMS EPiServer,一種可行的方法是采用anubhavas重寫規則並將其導入IIS中的“重寫模塊”。

http://www.iis.net/learn/extensions/url-rewrite-module/importing-apache-modrewrite-rules

當然,在首次安裝之后。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM