htaccess的用不同的量的变量的变量、不同、htaccess

2023-09-02 00:58:56 作者:蹲街、等天黑

我有在一个特定的页面它需要一个额外的变量一个网站。

目前,我使用的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

此外, [^ /] 不是必需的,你可以简单地使用

嵌入式C实现延时程序的不同变量的区别

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 ..