我有一個名爲category.php5的頁面,它使用$ _GET [「category」]從數據庫中獲取正確的內容。我想漂亮起來所以看起來像:.htaccess mod_rewrite問題 - 在腳下自己拍攝?
sinaesthesia.co.uk/category/psoriasis
這將等於:
sinaesthesia.co.uk/category.php5?category=psoriasis
我之前已經成功完成了這種重寫,但由於我現在無法完成這項工作,我擔心我可能會制定某些規則,這些規則會以某種方式搞砸我。這裏是我的整個.htaccess文件 - 最後的幾行應該做上述改寫:
RewriteEngine On
#remember to change this to aromaclear
RewriteCond %{HTTP_HOST} !^sinaesthesia\.co.uk$ [NC]
RewriteRule ^(.*)$ http://sinaesthesia.co.uk/$1 [R=301,L]
#Translate default page to root
RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php5|html)\ HTTP
RewriteRule ^(.*)index\.(php5|html)$ /$1 [R=301,L]
#translate any .html ending into .php5
RewriteRule ^(.*)\.html$ /$1\.php5
#change/for ?
RewriteRule ^(.*)\.html/(.*)$ /$1\.html?$2
#strip .html from search res page
RewriteRule ^(.*)search/(.*)$ /$1search_results\.html/search=$2
#translate product details link from search res page
RewriteRule ^products/(.*)/(.*)/(.*)$ /product_details.php5?category=$1&title=$2&id=$3 [L]
#Translate products/psorisis/chamomile-skin-cream-P[x] to productview.php5?id=1
RewriteRule ^products/.*-P([0-9]+) /productview.php5?id=$1 [L]
#Translate /category/psoriasis to /category.php5?category=$1
RewriteRule ^category/(.*) /category.php5?category=$1 [L]
當我手動輸入category.php5 /類別=牛皮癬,它的偉大工程。當我輸入category.php5/category /牛皮癬時,它不會。我擔心我的行改變了HTML/HTML?是一個錯誤,但是當我把這條線路出來時,它仍然不起作用。其他一切按預期工作。
是否應用該URL中的任何規則? – Gumbo 2009-09-28 19:51:01
不是我所知道的 - 我獲得了404狀態。 – user97410 2009-09-28 20:17:53