0
我使用httaccess mod_rewrite產品網站。httacess:我怎麼能最小化規則
當產品將是添加,
我創建的產品類別中的URL 像
層級1) http://www.example.com/Place-an-ad/Cars/Mazda/mazda-y/mazda-y-2/ 4 levels here 2) http://www.example.com/Place-an-ad/Books/Science/ 2 levels here 3) http://www.example.com/Place-an-ad/Realestate/Apprtments/small/ 3 levels here
類別可以是2,3或4級
我把這在httacces,雖然我不想重複。
RewriteRule ^Place-an-ad/(.*)/(.*)/(.*)/(.*)/(.*)/?$ new_ad.php?c1=$1&c2=$2&c3=$3&c4=$4 [NC,L] # for 4 level categories RewriteRule ^Place-an-ad/(.*)/(.*)/(.*)/(.*)/?$ new_ad.php?c1=$1&c2=$2&c3=$3 [NC,L] # for 3 level categories RewriteRule ^Place-an-ad/(.*)/(.*)/(.*)/?$ new_ad.php?c1=$1&c2=$2 [NC,L] # for 2 level categories RewriteRule ^Place-an-ad/(.*)/(.*)/?$ new_ad.php?c1=$1 [NC,L] # for 1 level category
任何一個都可以縮短這個範圍,以便所有類別都可以通過一條規則處理。
感謝
有什麼進一步的建議嗎? – 2011-02-09 06:04:02