How to redirect custom post type posts to one url with htaccess?

I have a custom post type "products". I would like to redirect all posts from "products" to one url ex: http://example.com/page1 using htaccess.

For example: http://example.com/products/post1, http://example.com/products/post2 and http://example.com/products/post3 to be on link click redirected to one page http://example.com/page1

Options +FollowSymLinks RewriteEngine On RewriteRule ^products/(.*)$ /http://example.com/page1 [R=301,L]

I cant find this topic anywhere. Please help.

Topic redirect custom-post-types Wordpress

Category Web


This answer from Webmaster StackExchange might be helpful:

RewriteRule ^products/ /page1/ [R=301,L]

Goes after the RewriteEngine and RewriteBase rules, but above all the other WordPress stuff.

If you don't want to fiddle with the .htaccess, you can have a look at the Redirection plugin.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.