.htaccess 如何从/index.php之类的文件中进行301 redrect?sect=程序

.htaccess 如何从/index.php之类的文件中进行301 redrect?sect=程序,.htaccess,url,redirect,.htaccess,Url,Redirect,我想301重定向mydomainname.com/index.php?sect=programs到mydomainname.com 我已在.htaccess文件中尝试了此操作: Redirects 301 /index.php?sect=programs http://mydomainname.com 但这不起作用。谢谢 尝试将以下内容添加到mydomainname站点根目录中的.htaccess文件中 RewriteEngine on RewriteBase / RewriteCond %

我想301重定向
mydomainname.com/index.php?sect=programs
mydomainname.com

我已在.htaccess文件中尝试了此操作:

Redirects 301 /index.php?sect=programs http://mydomainname.com

但这不起作用。谢谢

尝试将以下内容添加到
mydomainname
站点根目录中的
.htaccess
文件中

RewriteEngine on
RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?sect=programs\  [NC]
RewriteRule ^ http://mydomainname.com [L,R=301] 

Redirects
不是apache指令,但查询字符串无论如何不属于
Redirect
指令。