2015-05-13 347 views

回答

1

您需要忽略重寫時的實際文件和目錄,並且不要轉義$

您可以使用:

RewriteEngine On 

# rule to ignore files and directories from all rewrite rules below 
RewriteCond %{REQUEST_FILENAME} -d [OR] 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule^- [L] 

RewriteRule ^([^/]+)/?$ /index.php?p=$1 [L,QSA] 

RewriteRule ^([^/]+)/([^/]+)/?$ /index.php?p=$1&id=$2 [L,QSA]