我正在尝试在Wordpress .htaccess文件中添加RewriteRule
我想重定向所有具有永久链接结构的博客文章
/?p=123/
至/blog/%postname%/
例如:
我想设置自动重定向自
https://freshmail.pl/?p=177125
到
https://freshmail.pl/blog/czy-email-marketing-jest-skuteczny/
在我的Wordpress永久链接设置中,我获得了自定义结构和:
https://freshmail.pl/blog/%postname%/
,但无法将/?p = 123自动重定向到/ blog /%postname%/
我尝试添加
RewriteRule ^/.*$ /blog/$1/ [R=301,L,QSA]
在我的.htaccess文件中,但无法正常工作。
答案 0 :(得分:0)
尝试使用.htaccess:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^p=177125$
RewriteRule ^(.*)$ blog/czy-email-marketing-jest-skuteczny/ [R=301,L,QSA]
您需要为每个页面重复RewriteCond
和RewriteRule
行。
在htaccess tester上进行了测试,它可以正常工作。