Title: Conditional redirecting
Last modified: July 21, 2023

---

# Conditional redirecting

 *  [begadoc](https://wordpress.org/support/users/begadoc/)
 * (@begadoc)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/conditional-redirecting-2/)
 * As webmaster of the village web site I have been asked to add something which
   I don’t thinks is possible! 
   In the village is a small wild life area. At the
   gate is a notice with a QR code that leads to a YouTube video about what can 
   be seen at this time in the area. What I have been asked to do is setup a means
   of directing the person using the QR code to the village web site and from there
   redirecting them to a YouTube video appropriate for the month or season.Is this
   possible, or more to the point, easily done? If it is, I’d appreciate a pointer
   to the how.
    -  This topic was modified 2 years, 10 months ago by [begadoc](https://wordpress.org/support/users/begadoc/).
      Reason: clarification
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fconditional-redirecting-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [tugbucket](https://wordpress.org/support/users/tugbucket/)
 * (@tugbucket)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/conditional-redirecting-2/#post-16913240)
 * Generically, if the QR code takes them to a particular page in the site then 
   auto redirects, you really just need a static file not a page and you could do
   something like:
 *     ```wp-block-code
       <?php 
       $month = date('m');
   
       if($month == 1){
       	header("Location: https://youtube.com/x");
       	die();
       } elseif($month == 2){
       	header("Location: https://youtube.com/y");
       	die();
       } elseif($month == 3){
       	header("Location: https://youtube.com/z");
       	die(); 
       } else {
          /* some default action... */
       }
       ?>
       ```
   
 * Totally untested so just an idea.
 *  Thread Starter [begadoc](https://wordpress.org/support/users/begadoc/)
 * (@begadoc)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/conditional-redirecting-2/#post-16913626)
 * Many thanks – will give that a try.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Conditional redirecting’ is closed to new replies.

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 2 replies
 * 2 participants
 * Last reply from: [begadoc](https://wordpress.org/support/users/begadoc/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/conditional-redirecting-2/#post-16913626)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
