Title: Using $_SERVER[&#039;REQUEST_URI&#039;]
Last modified: August 22, 2016

---

# Using $_SERVER['REQUEST_URI']

 *  Resolved [keith_e](https://wordpress.org/support/users/keith_e/)
 * (@keith_e)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/using-_serverrequest_uri/)
 * Hi
 * I have two websites with exactly the same layout and structure, one is in English
   and the other is in French. I have put two buttons on each site to swap between
   the two. So if a visitor is on [http://www.frenchsite.com/services](http://www.frenchsite.com/services)
   and wants to go to the same page on the English site (www.englishsite.com/services),
   they click on the ‘English’ button.
 * I’m having difficulties with getting $_SERVER[‘REQUEST_URI’] to work properly.
 * I’m trying to use, for example, on the French site (www.frenchsite.com)
    `<a 
   href="<?php ‘http://www.englishsite.com’.$_SERVER['REQUEST_URI']; ?>" id="flag"
   ><img src="<?php bloginfo('template_url'); ?>/images/ausflag-50x25.png" title
   ="English"></a>`. to go to the equivalent page on the English site.
 * It doesn’t construct the URL correctly. Instead it constructs [http://www.frenchsite.com/services](http://www.frenchsite.com/services)
   for example, rather than [http://www.englishsite.com/services](http://www.englishsite.com/services).
 * Some help please?
 * Cheers
    Keith

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

 *  [Jesin A](https://wordpress.org/support/users/jesin/)
 * (@jesin)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/using-_serverrequest_uri/#post-5585380)
 * Are you missing out an `echo` in the PHP statement?
 *     ```
       echo 'http://www.englishsite.com'.$_SERVER['REQUEST_URI'];
       ```
   
 *  Thread Starter [keith_e](https://wordpress.org/support/users/keith_e/)
 * (@keith_e)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/using-_serverrequest_uri/#post-5585431)
 * Hi Jesin
 * Yes. That was the issue. Many thanks for your help.
 * Cheers
    Keith

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

The topic ‘Using $_SERVER['REQUEST_URI']’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [keith_e](https://wordpress.org/support/users/keith_e/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/using-_serverrequest_uri/#post-5585431)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
