WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I correctly send all traffic from:




(not seen by visitors)

Using mod-rewrite so that when I hit that URL I see the /case-studies/ page in Wordpress (in the database) with "Hello $clientName"?

Do I need to create a custom page file, or can I get by with my Wordpress page in the database?

Thank you!!

share|improve this question

This can be accomplished with WordPress's internal rewrite system by using add_rewrite_rule and adding a query var.

function wpse47506_rewrites_init(){
        'top' );
add_action( 'init', 'wpse47506_rewrites_init' );

function wpse47506_query_vars( $query_vars ){
    $query_vars[] = 'clientname';
    return $query_vars;
add_filter( 'query_vars', 'wpse47506_query_vars' );

This would go in your functions.php file, then visit the permalinks settings page to flush rewrite rules.

You can access the value of the query var in your page template with:

<?php echo 'Hello ' . get_query_var('clientname'); ?>
share|improve this answer
Worked like a charm! Thanks Milo! Great job! – Tony D Mar 31 '12 at 20:16

Your Answer


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

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