2014-02-16 216 views
1

你好,這是我第一次在這麼計算器很高興見到你所有的:) 我有我的.htaccess文件用htaccess重寫規則。 (點)

RewriteRule ^folder/([^/.]+)(/?)$ page.php?x=$1 [L] 
RewriteRule ^folder/([^/.]+)/([^/.]+)(/?)$ page.php?x=$1&y=$2 [L] 
RewriteRule ^folder/([^/.]+)/([^/.]+)/([^/.]+)(/?)$ page.php?x=$1&y=$2&z=$3 [L] 

http://localhost/test/folder/hello/001/ 

http://localhost/test/folder/hello/001/1/ 
工作

但是。 (點)不工作

http://localhost/test/folder/hello/001.1/ 

我怎麼能做到這一點,並認爲

回答

0
RewriteRule ^folder/([^/.]+)(/?)$ page.php?x=$1 [L] 
RewriteRule ^folder/([^/.]+)/([^/]+)(/?)$ page.php?x=$1&y=$2 [L] 
RewriteRule ^folder/([^/.]+)/([^/.]+)/([^/.]+)(/?)$ page.php?x=$1&y=$2&z=$3 [L] 
+0

非常感謝:) – Bahad001

+0

@ Bahad001歡迎! – falinsky

2

從負字符類刪除點:

# skip rewriting for valid files/directories 
RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 

RewriteRule ^folder/([^/]+)/?$ page.php?x=$1 [L] 
RewriteRule ^folder/([^/]+)/([^/]+)/?$ page.php?x=$1&y=$2 [L] 
RewriteRule ^folder/([^/]+)/([^/]+)/([^/]+)/?$ page.php?x=$1&y=$2&z=$3 [L] 

PS:這裏需要先治跳過重寫有效的文件/目錄