我需要幫助我的網站htaccess URL重寫。.htaccess站點重定向規則
問題是,某個類別的第一頁有好的無殘留URL,所有其他頁面都有髒網址。
例如第一頁有這樣的鏈接:
http://www.my-site-name.com/Category-name/Subcategory-name/
但第2頁,以及任何其他頁面是這樣的:
http://www.my-site-name.com/showcat.php?cat=Category-name&subcat=Subcategory-name&page=2
http://www.my-site-name.com/showcat.php?cat=Category-name&subcat=Subcategory-name&page=3
所以,我需要一些搜索引擎友好的htaccess的重定向規則使網址是這樣的:
http://www.my-site-name.com/Category-name/Subcategory-name-page-X/
或類似這樣的
http://www.my-site-name.com/Category-name/Subcategory-name/X/
但是可能我想再多一次。
這是的.htaccess的一部分爲:(我只是添加了完整的內容,也許有關於它的更多的東西
## For top rated items
RewriteRule ^top/page/(.*)/$ top.php?page=$1 [L]
## For latest items
RewriteRule ^latest/recent-page-(.*)/$ latest.php?page=$1 [L]
## For show most rated - most clicked - most downloaded and most searched items
RewriteRule ^most-rated.html$ showmost.php?type=1 [L]
RewriteRule ^most-clicked.html$ showmost.php?type=2 [L]
RewriteRule ^most-downloaded.html$ showmost.php?type=3 [L]
RewriteRule ^most-Searched.html$ showmost.php?type=4 [L]
## For showing category of item
RewriteRule ^(.*)/$ showcat.php?cat=$1 [L]
## For showing subcategory of item
RewriteRule ^(.*)/(.*)/$ showcat.php?cat=$1&subcat=$2 [L]
## For showig item
RewriteRule ^(.*)/(.*)/(.*).html$ show.php?cat=$1&sub_cat=$2&img=$3&rewrite=true [L]
## this section should be inserted just after the showing item rule above
#if the query string has cat, sub_cat and Img
RewriteCond %{QUERY_STRING} ^cat=(.+)&sub_cat=(.+)&img=(.+)$ [NC]
#and it is for resource show.php, then 301 redirect to Keyword rich URL
RewriteRule ^show\.php$ http://www.my-site-name.com/%1/%2/%3.html? [NC,L,R=301]
。我是新手,請告訴我如何接受正確的答案,我該怎麼辦? – 2011-12-27 19:08:25
答案左邊有一個灰色的複選標記,只需點擊回答您問題的問題旁邊的那個(最好) – Gerben 2011-12-27 19:28:12