尝试不同的方法:
RewriteEngine On
RewriteBase /subfolder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/([0-9]+)/$ index.php?a=$1&b=$2&token=$3 [L,QSA]
输出:(http://example.com/subfolder/menu/1/1/#/)
<?php
print_r($_GET);
Array
(
[a] => menu
[b] => 1
[token] => 1
)
?>
或者http://example.com/subfolder/menu/1/18d519decbe60db44154b1fbc8c553ac4/#/
RewriteEngine On
RewriteBase /subfolder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/([A-Za-z0-9]+)/$ index.php?a=$1&b=$2&token=$3 [L,QSA]
更新:
RewriteEngine On
RewriteBase /subfolder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/([0-9]+)/([A-Za-z0-9]+)/$ index.php?a=$2&b=$3&token=$4 [L,QSA]
将匹配:mysite.com/subfolder/menu/1/2/blah123
并传递给index.php?a=1&b=2&token=blah123
更新 2(因为没有子文件夹 - 见评论):
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9]+)/([0-9]+)/([0-9]+)/([A-Za-z0-9]+)/$ index.php?a=$3&b=$4&token=$5 [L,QSA]
将匹配:mysite.com/subfolder/menu/1/2/blah123
并传递给index.php?a=1&b=2&token=blah123
请阅读本网站: http ://corz.org/serv/tricks/htaccess2.php