0

I don't know .htaccess well. I wanted to do something like this. When a user will go to this link:

www.example.ca/C2767442

I want to redirect them to

www.example.ca/index.php?searchtext=C2767442&action=searchresults

I have tried like below :

RewriteEngine On
RewriteRule ^([^a-z0-9-])$  index.php?searchtext=$1&action=searchresults  [NC,L]

any help?

4

1 回答 1

2

您正在寻找的可能是这个(虽然我还没有测试过):

RewriteRule ^([a-zA-Z0-9]+)$  index.php?searchtext=$1&action=searchresults  [NC,L]
  1. 您忘记添加大写字符
  2. [] 中的 ^ 表示:“匹配括号中除字符类之外的所有内容。
于 2013-11-08T19:43:42.137 回答