0
我使用Isapi Rewrite for IIS,並且我想爲動態產品頁面製作SEO友好的URL。在兩種情況下用Isapi替換空格的正則表達式ReWrite
我需要在兩個查詢字符串參數不同的替代空間。
#seo. 2 conditions. split on _ delimiter.
RewriteRule ^Store/([^_]+)_([^/]+) Store/Details.aspx?id=$1&name=$2 [QSA,NC]
#replace spaces with + in first condition (doesn't work)
#RewriteRule ^Store/([^\w\s]+)\s(.+)$ Store/Details.aspx?id=$1+$2 [QSA, NC]
#replace spaces with dash in second condition ???
例子
Store/NP SP_name name
//$1: NP+SP
//$2: name-name
// output: Store/NP+SP_name-name
Store/mn%2098%20765_name%20name%20name
//$1: mn+98+765
//$2: name-name-name
//output: Store/mn+98+765_name-name-name
嗨,這對NP SP名稱起作用,但對NP SP名稱名稱或mn%2098%20765_name%20name%20name不起作用。 – User970008 2012-07-26 02:24:00
有沒有辦法來取代條件的所有空間?不只是第一個 – User970008 2012-08-02 17:47:33