Rewrite API Not Working
-
I just created my first rewrite rule using the WordPress Rewrite API but it does not work.
The code runs in the activation hook of a plugin and reads as follows:
add_rewrite_rule(‘redirect/([0-9]+)/?’, ‘wp-content/plugins/redirect/source/index.php?urlid=$matches[1]’, ‘top’);
flush_rewrite_rules();This successfully adds the rewrite rule to the .htaccess file as:
RewriteRule ^redirect/([0-9]+)/? /wordpress/wp-content/plugins/myplugin/redirect/index.php?urlid=$matches[1] [QSA,L]
This should result in a page getting the urlid, looking up the url, and doing a 302 redirect but instead I get a 404 error page from WordPress.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Rewrite API Not Working’ is closed to new replies.