简体   繁体   中英

htaccess rules hit 404 when using numbers in url

I've following htaccess to generate permalinks for my app:

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>

Is correct regexp: [0-9a-z-] ?

Yes to match numbers also use these rules:

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM