htaccess的重写规则上的index.php二送变量? [英] .htaccess rewrite rule for two GET variables on index.php?

查看:204
本文介绍了htaccess的重写规则上的index.php二送变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个重写,但我找不到它还是做我自己。

I'm trying to do a rewrite but I couldn't find it or do it myself.

我想转换

http://www.homepage.com/variable1/variable2 http://www.homepage.com/index.php? VAR1 =变量1&放大器; VAR2 =变量2 http://www.homepage.com/?var1=variable1&var2=variable2

我已经试过

  • 重写规则^ / / $ VAR1 = $ 1安培(*)(*);?VAR2 = $ 2 [NC,L]
  • 重写规则^ / $ VAR1 = $ 1安培(*)(*);?VAR2 = $ 2 [NC,L]
  • 重写规则^ / / $的index.php VAR1 = $ 1安培(*)(*);?VAR2 = $ 2 [NC,L]
  • 重写规则^ / $的index.php VAR1 = $ 1安培(*)(*);?VAR2 = $ 2 [NC,L]
  • RewriteRule ^/(.*)/(.*)$ ?var1=$1&var2=$2 [NC,L]
  • RewriteRule ^(.*)/(.*)$ ?var1=$1&var2=$2 [NC,L]
  • RewriteRule ^/(.*)/(.*)$ index.php?var1=$1&var2=$2 [NC,L]
  • RewriteRule ^(.*)/(.*)$ index.php?var1=$1&var2=$2 [NC,L]

所有这些工作。我究竟做错了什么?谢谢!

none of these worked. What am I doing wrong? Thanks !

推荐答案

这为我工作:

RewriteRule ^(.*)/(.*)$ /index.php?var1=$1&var2=$2 [NC,L]

您没有把/ index.php文件之前。

You didn't put / before index.php.

这篇关于htaccess的重写规则上的index.php二送变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆