2

我已经关注 htaccess 为我的应用程序生成永久链接:

6   #Permalinks
7   RewriteEngine on
8   <IfModule mod_rewrite.c>
9   RewriteEngine On
10  #catch potential subpages first
11  RewriteRule ^([a-z-]+)/([a-z-]+)/?$ index.php?page=$1&subpage=$2 [L,NC,QSA]
12  #
13  RewriteRule ^([a-z-]+)/?$ index.php?page=$1 [L,NC,QSA]
14  </IfModule>

是正确的正则表达式:[0-9a-z-]

4

1 回答 1

1

是匹配数字也使用这些规则:

RewriteRule ^([a-z0-9-]+)/([a-z0-9-]+)/?$ index.php?page=$1&subpage=$2 [L,NC,QSA]

RewriteRule ^([a-z0-9-]+)/?$ index.php?page=$1 [L,NC,QSA]
于 2013-11-14T07:52:50.023 回答