Add a custom url rewrite rule to wordpress

  • Unknown's avatar

    Hi wordpresscommunity,

    I’am trying to add a custom URL rewrite to my wordpress-site. When %25% is in located in the url, I want to forward to index.php (dont ask me why ;)). The correct rewrite I stumbled across is:

    add_rewrite_rule(‘^(.)%25%(.)$’,’index.php’, ‘top’);

    I red that the url rewrite has to be added as a plugin. My plugin looks like this:

    <?php
    /**
    * Plugin Name: Custom url rewrite
    * Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
    * Description: custom url rewrite
    * Version: 1.0
    * Author: Henk
    * Author URI: http://URI_Of_The_Plugin_Author
    * License: GPL2
    */
    function init() {
    add_rewrite_rule(‘^(.)%25%(.)$’,’index.php’, ‘top’);}

    It doesn’t do anything after being activated! not even after flushing my url rewrites. What do I do wrong?

    Thanks!

  • The topic ‘Add a custom url rewrite rule to wordpress’ is closed to new replies.