Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress HTACCESS从URL重定向,包括?到静态页面_Wordpress_.htaccess_Redirect - Fatal编程技术网

Wordpress HTACCESS从URL重定向,包括?到静态页面

Wordpress HTACCESS从URL重定向,包括?到静态页面,wordpress,.htaccess,redirect,Wordpress,.htaccess,Redirect,我每天都会从我写的一本现已不存在的教程中得到几首歌曲。我没有让他们坐在404上,而是创建了一个页面,上面有更多最新页面的链接,希望其他人能提供帮助 我正在尝试编辑我的htaccess to rediret 我的网站是可湿性粉剂供电和传入的链接是 /tutorials/?p=3 我想把它转到: /wiki/sorry-this-tutorial-no-longer-exists 我试过: Redirect /tutorials/?p=3 http://domain.com/wiki/sorr

我每天都会从我写的一本现已不存在的教程中得到几首歌曲。我没有让他们坐在404上,而是创建了一个页面,上面有更多最新页面的链接,希望其他人能提供帮助

我正在尝试编辑我的htaccess to rediret

我的网站是可湿性粉剂供电和传入的链接是

/tutorials/?p=3
我想把它转到:

/wiki/sorry-this-tutorial-no-longer-exists 
我试过:

Redirect /tutorials/?p=3 http://domain.com/wiki/sorry-this-tutorial-no-longer-exists 
最近的一次是

RedirectMatch 301 ^/tutorials/?(.*)  http://domain.com/wiki/sorry-this-tutorial-no-longer-exists 
但这当然会把…存在/?p=3粘在最后,这不起作用


这该死的问号有什么帮助吗?(我试过了,但没用?

我相信这应该能满足您的需求

RewriteEngine on
RewriteCond %{REQUEST_URI}  ^/tutorials/$
RewriteCond %{QUERY_STRING} ^p=3
RewriteRule ^(.*)$ http://domain.com/wiki/sorry-this-tutorial-no-longer-exists? [R=302,L]

是的,这看起来更像。然而,这仍然给了我一个结果。无论如何,要删除?p=3我错过的道歉?结束了。我已经更新了答案只是一个细节,但是使用
^\bp=3\b
,否则像
?cab=300
这样的查询模式将得到匹配。好东西!现在效果很好。非常感谢修复和@TerryE的调整。