admin管理员组文章数量:1317915
How can I redirect non existent pages/posts in WordPress using only .htaccess file?
Here is my code:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^products/cool-tshirt$ /tshirts [R=301,L]
</IfModule>
Thank you in advance.
How can I redirect non existent pages/posts in WordPress using only .htaccess file?
Here is my code:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^products/cool-tshirt$ /tshirts [R=301,L]
</IfModule>
Thank you in advance.
Share Improve this question asked May 7, 2014 at 8:02 NorotiNoroti 11 silver badge1 bronze badge 2 |1 Answer
Reset to default 1This should work:
RedirectMatch 301 ^/products/cool-tshirt$ http://yourdomain/tshirts$1
You can also see a bunch of other options and solutions here
Hope this helps.
本文标签: How to redirect non existent pagesposts in wordpress using htaccess
版权声明:本文标题:How to redirect non existent pagesposts in wordpress using htaccess 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742024667a2415316.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
RewriteRule
directive above should already do what you require. If it's not working then you've probably put in in the wrong place - this redirect needs to go at the top of the.htaccess
file, before the WordPress front-controller. If you are not using WP's permalinks (in which case you may not have WP front-controller in.htaccess
) then make sure that mod_rewrite is enabled on your server. – MrWhite Commented May 24, 2018 at 11:34