2
下面是我使用URL重写我们.htaccess
文件的.htaccess URL重写如果一个参数是不存在的
Options +FollowSymLinks
RewriteEngine on
RewriteBase/
RewriteRule pages/(.*)/? /page/index.php?name=$1 [NC,L]
从上面的代码的代码,如果该URL为www.example.com/pages/2
那么实际上它去URL www.example.com/page/index.php?name=2
而且我想是这样的:如果一个页面请求是www.example.com/pages/2/user/rahul
那么它也应该去相同的URL www.example.com/page/index.php?name=2&user=rahul
这样做上述的事情,我不喜欢的东西这个:
Options +FollowSymLinks
RewriteEngine on
RewriteBase/
RewriteRule pages/(.*)/? /page/index.php?name=$1 [NC,L]
RewriteRule pages/(.*)/user/(.*)/? /page/index.php?name=$1&user=$2 [NC,L]
但它不工作,我想要的。