简单的 .htaccess 重定向:如何使用参数进行重定向? [英] simple .htaccess redirect : how to redirect with parameters?

查看:35
本文介绍了简单的 .htaccess 重定向:如何使用参数进行重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标只是重定向:

/jsn.php?parametershttp://www.site2.com/jsn.php?parameters

我试过

Redirect permanent /jsn.php(.)* http://www.site2.com/jsn.php$1

推荐答案

查询字符串参数自动传递,你只要这样做:

Query string parameters are automatically passed, you simply want to do this:

Redirect permanent /jsn.php http://www.site2.com/jsn.php

(.)* 不适用于 Redirect 指令,您可能正在考虑 RedirectMatch,但无论哪种方式,您不需要它.而且 (.)* 应该是 (.*),否则 $1 反向引用只会得到第一个字符.

The (.)* doesn't work with the Redirect directive, you were probably thinking of RedirectMatch, but either way, you don't need it. And also (.)* should be (.*), otherwise the $1 backreference would only get the first character.

这篇关于简单的 .htaccess 重定向:如何使用参数进行重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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