.htaccess 多参数URL重定向到另一个preety URL

.htaccess 多参数URL重定向到另一个preety URL,.htaccess,.htaccess,我想通过htaccess重定向: test.mydomain.com/articles\u main.php?post=postile&name=&email= 致: mydomain.com/postile 非常感谢您的帮助,我已经为此奋斗了很长时间,请帮助 编辑: 我已经测试了很多东西,但剩下的评论是: 你的正则表达式不正确。使用此代码: RewriteEngine On RewriteCond %{HTTP_HOST} ^test\.mydomain\.com$ [NC] Rewri

我想通过htaccess重定向:
test.mydomain.com/articles\u main.php?post=postile&name=&email=

致:
mydomain.com/postile

非常感谢您的帮助,我已经为此奋斗了很长时间,请帮助

编辑: 我已经测试了很多东西,但剩下的评论是:


你的正则表达式不正确。使用此代码:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^test\.mydomain\.com$ [NC]
RewriteCond %{THE_REQUEST} \s/articles_main\.php\?post=([^&]+)&name=([^&]*)&email=([^&\s]*) [NC]
RewriteRule ^ http://mydomain.com/$1? [L,R=301]

RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteRule ^([A-Za-z0-9]+)/?$ articles_main\.php?post=$1name=&email= [L,QSA]

欢迎来到SO!请向我们展示您长期奋斗的最佳尝试…编辑问题并在那里发布您的代码,从评论中阅读非常困难。不起作用,我也尝试过,但没有成功:重写规则^articles_main\.php\?post=([^&]+)&name=([^&]*)email=([^&]*)$[L,R=301]另外,我想要重定向到新域
RewriteEngine On

RewriteCond %{HTTP_HOST} ^test\.mydomain\.com$ [NC]
RewriteCond %{THE_REQUEST} \s/articles_main\.php\?post=([^&]+)&name=([^&]*)&email=([^&\s]*) [NC]
RewriteRule ^ http://mydomain.com/$1? [L,R=301]

RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteRule ^([A-Za-z0-9]+)/?$ articles_main\.php?post=$1name=&email= [L,QSA]