htaccess的用不同的量的变量的 [英] htaccess With a different amount of variables
本文介绍了htaccess的用不同的量的变量的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有在一个特定的页面它需要一个额外的变量一个网站。
目前,我使用的htaccess是:
RewriteEngine叙述上
重写规则^([^ /] *)/ $ /index.php?page=$1 [L]
用哪一个变量正常工作。
我如何得到它的工作: http://tessite.com/index.php?page=test&id=1
所以它看起来像: http://tessite.com/test/1
感谢您的任何帮助或答复。
解决方案
RewriteEngine叙述上
重写规则^(。*)/(。*)/ $ /index.php?page=$1&id=$2 [L]
重写规则^(。*)/ $ /index.php?page=$1 [L]
只需添加 $ 2
!
此外, [^ /]
不是必需的,你可以简单地使用。
。
I have a website that on one specific page it requires an extra variable.
At the moment, the htaccess I am using is:
RewriteEngine On
RewriteRule ^([^/]*)/$ /index.php?page=$1 [L]
Which works fine with one variable.
How would I get it to work with : http://tessite.com/index.php?page=test&id=1
So it looked like: http://tessite.com/test/1
Thanks for any help or replies.
解决方案
RewriteEngine On
RewriteRule ^(.*)/(.*)/$ /index.php?page=$1&id=$2 [L]
RewriteRule ^(.*)/$ /index.php?page=$1 [L]
Just add $2
!
Also, [^/]
isn't required, you can simply use .
.
这篇关于htaccess的用不同的量的变量的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文