Rewrite Rule for Custom Post Type
-
Hi,
i’ve created acustom PostType and would like to achieve the following goal:
/ctype/postname/
There are links which looks like the following, but for this link there exists no post / page.
/ctype/postname/unique-id/
I thought I could redirect it in the .htaccess to an existing post, which then delivers me all formation by the “unique-id”
RewriteRule ^ctype/(.*)/(.*)/$ index.php/?p=100&cid=$2&name=$1 [L]
I also tried it with a WP rewrite rule, unfortunately without success.
add_rewrite_rule( 'ctype/([^/]+)/([^/]+)', 'index.php/?p=100&cid=$matches[2]&name=$matches[2]', 'top' );
Has anyone here a tip or is it completely the wrong approach?
Many Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Rewrite Rule for Custom Post Type’ is closed to new replies.