我想通过参数ofr example:
在url上通过htacces重定向domain1.com/asd - > domain2.com/sdew;as domain1.com/ase - > domain2.com/sdew;aw
我在htacces条件中使用如下:
/* Program : Ch12Ex12
* Programmer : Chase Mitchell
* Date : 4/21/2016
* Description : Lets Make A Zonk
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Ch12Ex13
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Random rnd = new Random();
string[] prises=new string[3]{"trip to japan!","Zonk","Cruise"};
int x = 0;
int pr1=0, pr2=0, pr3=0,val1=0,val2=0,val3=0;
int Cur1 = rnd.Next(1, 3);
int Cur2 = rnd.Next(1, 3);
int Cur3 = rnd.Next(1, 3);
do
{
if (Cur1 == Cur2)
{
Cur2 = rnd.Next(1, 3);
}
else if (Cur3 == Cur1 || Cur3 == Cur2)
Cur3 = rnd.Next(1, 3);
else
x = 2;
} while (x == 0);
if (Cur1 == 1)
{
picP1.Location = new Point(26, 35);
pr1 = 1;
val1 = 3;
}
else if (Cur2 == 1)
{
picP2.Location = new Point(26, 35);
pr2 = 1;
val1 = 1;
}
else if (Cur3 == 1)
{
picP3.Location = new Point(26, 35);
pr3 = 1;
val1 = 2;
}
if (Cur1 == 1)
{
picP1.Location = new Point(275, 35);
pr1 = 2;
val2 = 3;
}
else if (Cur2 == 1)
{
picP2.Location = new Point(275, 35);
pr2 = 2;
val2 = 1;
}
else if (Cur3 == 1)
{
picP3.Location = new Point(275, 35);
pr3 = 3;
val2 = 2;
}
if (Cur1 == 1)
{
picP1.Location = new Point(543, 35);
pr1 = 3;
val3 = 3;
}
else if (Cur2 == 1)
{
picP2.Location = new Point(543, 35);
pr2 = 3;
val3 = 1;
}
else if (Cur3 == 1)
{
picP3.Location = new Point(543, 35);
pr3 = 3;
val3 = 2;
}
lblP1.Text = prises[pr1];
lblP2.Text = prises[pr2];
lblP3.Text = prises[pr3];
lblV1.Text = Convert.ToString(val1);
lblV2.Text = Convert.ToString(val2);
lblV3.Text = Convert.ToString(val3);
}
private void btnP1_Click(object sender, EventArgs e)
{
if (Convert.ToInt32(lblTest) == 1)
{
if (Convert.ToInt32(lblV2.Text) < Convert.ToInt32(lblV3.Text))
{
btnP2.Enabled = false;
picC2.Visible = false;
}
else if (Convert.ToInt32(lblV2.Text) > Convert.ToInt32(lblV3))
{
btnP3.Enabled = false;
picC3.Visible = false;
}
lblOutput.Text = ("You missed out on a "+lblP1.Text);
lblMore.Text = ("Would you like to change your curtain? (click the same curtain again if you want to keep it)");
}
else
{
}
}
}
}
此规则从domain1.com/asd重定向到http://www.domain2.com/ssd/sdew%3bas
答案 0 :(得分:1)
将标志[R = 301,L,NC]更改为 [R = 301,L,NC,NE]
<强> NE 强> | noescape
默认情况下,特殊字符,例如&amp;和?,例如,将 转换为等效的十六进制代码。使用[NE]标志可以防止 发生的事情。