1
votes

I'm developing a website using wordpress. I have custom post type urls like :

review/assassins-creed-iii/

But the post type name is review, but I have to rewrite this word to product

    product/assassins-creed-iii/

or

    assassins-creed-iii/

It's ok me to remove that slug and show only the post slug

I used this htaccess code :

RewriteCond %{REQUEST_URI}  (.*)/review/(.*)
RewriteRule .* example.com/%1/product/%2  [QSA,R=301,L]

But this redirects me to 404 page. Anyone know how to change all urls as above?

Thank you

2
How are you adding the custom post type?Mat Taylor
there have plugin installed and it use custom post type to store reviewsSalinda Bandara
Try re saving settings>permalinks after the htaccess changes. Otherwise i would look into how to add your own custom post types, its not much code at all needed, then you can set the permalink yourself.Mat Taylor
saved but the same issue happeningSalinda Bandara

2 Answers

0
votes

Please give a try to this

RewriteRule ^review/(.*)   /products/$1   [L]

This will find "review" and replace it with products.

0
votes

i managed this using https://wordpress.org/plugins/custom-permalinks/ this allows me to change any permlinks