Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am building a plugin which relies on passing the url as a GET parameter. Now, I am trying to prettify the links by using rewrite rules but am stuck.

What I have now:

function oe_wpib_add_rewrite_rules() {

    add_rewrite_tag( '%wpib%','^(http(?:s)?\:\/\/[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,6}(?:\/?|(?:\/[\w\-]+)*)(?:\/?|\/\w+\.[a-zA-Z]{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$' );
    add_rewrite_rule( '^wpib/([^&]*)', 'index.php?wpib=$matches[1]', 'top' );


add_action( 'init', 'oe_wpib_add_rewrite_rules' );

What above does is recognizes 

and translates it to a

The problem is that when I pass the url like this:

I get this as the query value:

So basically, one slash is missing.

Can you help me out here, as I am lost, first time doing rewrites so would appreciate any guidance.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.