.htaccess 当URL已更改时进行htaccess重定向?查询字符串

.htaccess 当URL已更改时进行htaccess重定向?查询字符串,.htaccess,redirect,mod-rewrite,url-redirection,.htaccess,Redirect,Mod Rewrite,Url Redirection,从带有模式- 我想重定向到 http://example.com/istqb_dump.pdf 我创建了以下重定向规则 RewriteCond %{QUERY_STRING} format=pdf [NC] RewriteRule .* http:// example.com/istqb_dump.pdf? [R=301,L] 它工作得很好 现在还有其他URL,如下所示- 我想重定向到各自的URL live http://example.com/seo.pdf http://exampl

从带有模式-

我想重定向到

http://example.com/istqb_dump.pdf

我创建了以下重定向规则

RewriteCond %{QUERY_STRING} format=pdf [NC]
RewriteRule .* http:// example.com/istqb_dump.pdf? [R=301,L]
它工作得很好

现在还有其他URL,如下所示-

我想重定向到各自的URL live

http://example.com/seo.pdf

http://example.com/digital-marketing.pdf

但根据上述规则,所有URL都重定向到

http://example.com/istqb_dump.pdf


如何配置induvial重定向?

您需要使
重写规则更具体,为每种情况创建一个定制条件:

RewriteCond %{QUERY_STRING} format=pdf [NC]
RewriteRule ^top-100-selenium-interview-questions-answers.html /istqb_dump.pdf? [R=301,L]

RewriteCond %{QUERY_STRING} format=pdf [NC]
RewriteRule ^top-35-seo-interview-questions/? /seo.pdf? [R=301,L]

RewriteCond %{QUERY_STRING} format=pdf [NC]
RewriteRule ^top-15-digital-marketing-interview-questions/? /digital-marketing.pdf? [R=301,L]

此处演示:

更具体地说明您的重写规则匹配的内容…?我想从url重定向到该url。请告诉我.htaccess规则。