使用.htaccess我无法使用这样的链接:
public class Encryption : MonoBehaviour
{
public InputField input;
public Text output;
string inputText;
public Toggle L337Toggle;
public Toggle CharShiftToggle;
public Toggle DoubleCaseToggle;
public Toggle VowelToggle;
void Start()
{
L337Toggle.isOn = false;
CharShiftToggle.isOn = false;
DoubleCaseToggle.isOn = false;
VowelToggle.isOn = false;
}
private void Update()
{
inputText = input.text;
output.text = inputText;
IEncryption _textEncryption = new TextEncryption(inputText);
IEncryption _L337Encryption = new L337Encryption(_textEncryption);
IEncryption _CharShiftEncryption = new CharShiftEncryption(_textEncryption);
if (L337Toggle.isOn == true)
{
output.text = _L337Encryption.Encrypt();
}
else if (CharShiftToggle.isOn == true)
{
output.text = _CharShiftEncryption.Encrypt();
}
}
public interface IEncryption
{
string Encrypt();
}
public class TextEncryption : IEncryption
{
private string originalString;
public TextEncryption(string original)
{
originalString = original;
}
public string Encrypt()
{
Debug.Log("Encrypting Text");
return originalString;
}
}
public class L337Encryption : IEncryption
{
private IEncryption _encryption;
public L337Encryption(IEncryption encryption)
{
_encryption = encryption;
}
public string Encrypt()
{
Debug.Log("Encrypting L337 Text");
string result = _encryption.Encrypt();
result = result.Replace('a', '4').Replace('b', '8').Replace('e', '3').Replace('g', '6').Replace('h', '4').Replace('l', '1')
.Replace('o', '0').Replace('q', '9').Replace('s', '5').Replace('t', '7').Replace('A', '4').Replace('B', '8')
.Replace('E', '3').Replace('G', '6').Replace('H', '4').Replace('L', '1')
.Replace('O', '0').Replace('Q', '9').Replace('S', '5').Replace('T', '7');
return result;
}
}
public class CharShiftEncryption : IEncryption
{
private IEncryption _encryption;
public CharShiftEncryption(IEncryption encryption)
{
_encryption = encryption;
}
public string Encrypt()
{
Debug.Log("Encrypting Character Shift Text");
string result = _encryption.Encrypt();
string[] Letters=new string[] { "a", "b'", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l",
"m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
for (int i=0;i<Letters.Length;i++)
{
if (Letters[i] == result)
{
result = Letters[i + 1];
if (result == Letters[25])
{
result = Letters[0];
}
}
}
return result;
}
}
到
/quiz/results/solution-one/?email=myemail@domain.com
(解决方案 - 一个应该变成level = 4)
我花了几个小时建立.htaccess代码:
/results.php?level=4&email=myemail@domain.com
或者这个:
Rewriterule ^quiz\/results\/solution-one/(.*)/?$ /var/www/domain.com/public_html/results.php?level=4$1 [QSA,L]
但它不起作用。
提前致谢!
答案 0 :(得分:0)
尝试:
RewriteEngine on
Rewriterule ^quiz/results/solution-one/?$ results.php?level=4 [NC,QSA,L]
没有文件路径,但相对于root。并且没有测试查询字符串(不是Rewriterule测试uri的一部分)