我想将诸如http://www.maxprog.com/blog/?p=106之类的Wordpress博客帖子重定向到我创建的显示该帖子的脚本:http : //www.maxprog.com/site/blog /post.php?id=106
我尝试了以下失败:
RedirectMatch permanent ^/blog/?p=(.*)$ /site/blog/post.php?id=$1
RedirectMatch permanent ^/blog/index.php?p=(*)$ /site/blog/post.php?id=$1
RedirectMatch permanent ^/blog/(.*)$ /site/blog/post.php?id=$1
我只想重定向?p = xxx页面。
您无法使用mod-alias(RedirectMatch指令)与查询字符串匹配,要操作查询字符串,请使用mod-rewrite,将以下内容添加到htaccess中
RewriteEngine on
RewriteCond %{QUERY_STRING} ^p=([^&]+)$
RewriteRule ^ /site/blog/post.php?id=%1 [L,R]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句