Php URL传输到另一个URL.htaccess

Php URL传输到另一个URL.htaccess,php,apache,.htaccess,Php,Apache,.htaccess,我不知道,我很好。我想做这样的事。用户将转到此链接的时间: www.example.ca/C2767442 我想把它们重定向到 www.example.ca/index.php?searchtext=C2767442&action=searchresults 我试过如下方法: RewriteEngine On RewriteRule ^([^a-z0-9-])$ index.php?searchtext=$1&action=searchresults [NC,L] 有什

我不知道,我很好。我想做这样的事。用户将转到此链接的时间:

www.example.ca/C2767442
我想把它们重定向到

www.example.ca/index.php?searchtext=C2767442&action=searchresults
我试过如下方法:

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

有什么帮助吗?

您需要的可能是以下内容(我还没有测试):

  • 您忘了添加大写字符
  • []中的“^”表示:“匹配括号中除字符classess以外的所有内容

  • +1但要做到:
    RewriteRule^([a-z0-9]+)$index.php?searchtext=$1&action=searchresults[NC,L,QSA]
    RewriteRule ^([a-zA-Z0-9]+)$  index.php?searchtext=$1&action=searchresults  [NC,L]