2
Apache Mod重寫不適用於我在URL中使用( - )時?Apache Mod重寫不適用於我在URL中使用( - )時?
我試圖訪問
www.example.com/products/ipod/white-ipod-8gb/12345678
它不工作頁面,如何編輯.htaccess
文件?
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f
RewriteRule ^(.*)$ $1.php [L]
RewriteRule ^products/([^-]*)/([^-]*)/([^-]*)$ /products.php?produucts_name=$1&products_des=$2&products_id=$3 [L]
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
ErrorDocument 404 /404.php
ErrorDocument 403 /403.php
Options -indexes
「-'字符在正則表達式模式中有特殊含義。你需要像'\ -'那樣用反斜槓來轉義它 – marekful