0

For the past year, I've been using custom post types to distinguish my different post types (duh). Thing is, I'm now realizing that categories are more efficient in offering archived pages for these different types of posts.

As is, my custom post types are rewriting the permalink structure to show domain.com/post-type/post.php

I want to revert to the more standard permalink structure of domain.com/%category%/%postname%/

Thing is, I know this is going to break the URLs spread around the web to my already existing pages and I want to avoid that.

So for example, with the post type "review" my url would be domain.com/review/post.php when I want to switch to using category "reviews" for the url domain.com/reviews/post.php

To avoid breaking URLs, what would the best thing for me to do?

0

Your best bet will be a bunch of apache rewrite rules. Place something like this above the # BEGIN WordPress line in your .htaccess file:

<IfModule mod_rewrite.c>
    RewriteRule ^subdirectory/(.*)$ /anotherdirectory/$1 [R=301,NC,L]
</IfModule>

So, using your example of redirecting /review to /reviews:

<IfModule mod_rewrite.c>
    RewriteRule ^review/(.*)$ /reviews/$1 [R=301,NC,L]
</IfModule>

You can put as many rules as you need (i.e. 1 for each sub directory). You can read more about mod_rewrite here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.