我必須每個URL所有_(下劃線)與被替換 - (連字符)現代重寫:更換所有下劃線(_)與連字符( - )
我目前做這種方式,但我尋找一個更簡單的方法來做到這一點,所以我不必每次URL變長時添加一行。
RewriteRule ^([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^.]+)-([^.]+)-([^.]+)-([^.]+)$ index.php?/$1_$2_$3_$4_$5_$6_$7_$8_$10 [L]
RewriteRule ^([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^.]+)-([^.]+)-([^.]+)$ index.php?/$1_$2_$3_$4_$5_$6_$7_$8_$9 [L]
RewriteRule ^([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^.]+)-([^.]+)$ index.php?/$1_$2_$3_$4_$5_$6_$7_$8 [L]
RewriteRule ^([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^.]+)$ index.php?/$1_$2_$3_$4_$5_$6_$7 [L]
RewriteRule ^([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^.]+)$ index.php?/$1_$2_$3_$4_$5_$6 [L]
RewriteRule ^([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^.]+)$ index.php?/$1_$2_$3_$4_$5 [L]
RewriteRule ^([^_]+)-([^_]+)-([^_]+)-([^.]+)$ index.php?/$1_$2_$3_$4 [L]
RewriteRule ^([^_]+)-([^_]+)-([^.]+)$ index.php?/$1_$2_$3 [L]
RewriteRule ^([^_]+)-([^.]+)$ index.php?/$1_$2 [L]
謝謝。
你能解釋一下我在哪裏把代碼sedhyphen.sh和代碼#/ bin/sh的和sed -u的/ _/-/G'! – cointilt 2010-01-20 21:25:50
sedhyphen.sh爲您創建一個單獨的shell腳本。它應該放在'$ PATH'的某處。 – 2010-01-20 21:27:01
這個文件可以在服務器上託管,就像使用ftp的regualr文件一樣嗎?還是我需要使用ssh在服務器上安裝它自己? – cointilt 2010-01-20 21:33:01