Title: PHP If url Statement
Last modified: August 19, 2016

---

# PHP If url Statement

 *  [wireframe74](https://wordpress.org/support/users/wireframe74/)
 * (@wireframe74)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/php-if-url-statement/)
 * Hi I have a a wordpress mu site that was serving 3 different themes to US, UK
   and Australia. All data now comes from one site. I want to display different 
   content for each contact page for each country..
 * Something similar to this:
 *     ```
       <?
   
       if url="page1.php" then print("hi");
       if url="page2.php" then print("hello");
       if url="page3.php" then print("howdy");
   
       ?>
       ```
   
 * Advice greatly appreciated 🙂

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/php-if-url-statement/#post-1550443)
 * Since I don’t know what your actual URL will contain, or how you will get the
   URL, I can only give a general spproach.
 *     ```
       <?php
       $uri = $_SERVER['REQUEST_URI'];
       if ( strpos($uri,'page1.php') !== false ) {
          echo 'hi';
       } elseif ( strpos($uri,'page2.php') !== false ) {
          echo 'hello';
       } elseif ( strpos($uri,'page3.php') !== false ) {
          echo 'howdy';
       } else {
          echo 'unknown uri';
       }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘PHP If url Statement’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [15 years, 11 months ago](https://wordpress.org/support/topic/php-if-url-statement/#post-1550443)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
