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

问题描述

我的目标很简单,就是重定向:

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

我试着用

 永久重定向/jsn.php(.)* http://www.site2.com/jsn.php$1


解决方案

查询字符串参数将自动传递,你只是想做到这一点:

 永久重定向/jsn.php http://www.site2.com/jsn.php

()* 不与重定向指令工作,你很可能想的 RedirectMatch ,但无论哪种方式,你不需要它。而且()* (。*),否则在 $ 1 反向引用只得到第一个字符。

My goal is simply to redirect:

/jsn.php?parameters to http://www.site2.com/jsn.php?parameters

I tried with

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

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重定向:如何与参数重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:01