嗨,这是我第一次在stackoverflow中很高兴见到你们:) 我有我的.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 :(得分:3)
从负面角色类中删除点:
# 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:您需要先在此处规则跳过重写有效文件/目录
答案 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]