我想的另一个......
如何重写
http://domain.com/images/download/30
其中30
是生成的ID
http://domain.com/pages/files/download.php?id=30
我目前的尝试是这样的:
RewriteRule .+images/download/(\d+) /pages/files/download.php?id=$1
我在哪里错了?
我的.htaccess的其余部分是:
# turn rewriting on
RewriteEngine on
Options +FollowSymLinks
RewriteRule ^([^/\.]+)/?$ /index.php?page=$1 [L,NC,QSA]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&var1=$2 [L,NC,QSA]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&var1=$2&var2=$3 [L,NC,QSA]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&var1=$2&var2=$3&var3=$4 [L,NC,QSA]
答案 0 :(得分:3)
在其他规则添加之前
RewriteRule ^images/download/(\d+)$ /pages/files/download.php?id=$1 [L]
并且在/pages/
文件夹中你应该关闭重写引擎以避免对其他规则进行重新编写