Title: Request URI
Last modified: August 20, 2016

---

# Request URI

 *  Resolved [caylean](https://wordpress.org/support/users/caylean/)
 * (@caylean)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/request-uri/)
 * I was thinking this would be an easy Task, i still believe it is, but without
   PHP knowledge it is impossible to do correctly.
 * I try to add to an Link the active uri.
 * `<a onclick="popUpWin(this.href, 'console', 660, 425, 50, 50);return false;" 
   href="http://www.facebook.com/sharer.php?u=<?php echo $_SERVER['REQUEST_URI'];?
   >"><img src="<?php bloginfo('url'); ?>/images/facebook.png" alt="Facebook" width
   ="20" height="20" border="0" /></a>`
 * If a user is on the main site he has the correct url in the Link, if he is in
   a posting he also has it.
 * But whatever i Try like this Actual Code i posted above, or this
 * > <?php
   >  if (is_home()) echo “<?php bloginfo(‘url’); ?>”; } else { echo “<?php
   > the_permalink() ?>”; } ?>
 * instead of <?php echo $_SERVER[‘REQUEST_URI’]; ?> — it all isn’t function, could
   someone tell me where i do wrong? and how I could fix that, without using any
   kind of Plugin?
 * Kind Regards

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

 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/request-uri/#post-3079969)
 * This…
 *     ```
       if (is_home())
       echo "<?php bloginfo('url'); ?>";
       }
       ```
   
 * … will echo the literal string “<?php bloginfo(‘url’); ?>”. You don’t need to
   quote your argument and add a PHP block. You are already ‘in’ PHP. You are also
   missing a ‘{‘. That should be…
 *     ```
       if (is_home()) {
       echo bloginfo('url');
       }
       ```
   
 *  Thread Starter [caylean](https://wordpress.org/support/users/caylean/)
 * (@caylean)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/request-uri/#post-3079998)
 * THanks, thats it! 🙂
 * `<?php if (is_home()) { echo bloginfo('url'); } else { echo the_permalink(); }?
   >`
 * and it is all fine. This missing { comes due to the fact i know nothing about
   php 🙂
 * Just for some cosmetics in the echo bloginfo(‘url’) — Is it possible to add an/
   in the end to the Link? Now it is just [http://test.domain.tld](http://test.domain.tld)
 * But all in all it is resolved, thanks.
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/request-uri/#post-3080001)
 * Yes, just tack it on `bloginfo('url').'/';`
 *  Thread Starter [caylean](https://wordpress.org/support/users/caylean/)
 * (@caylean)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/request-uri/#post-3080008)
 * Hehe, thats indeed very easy, if you know that there yould be .’ before and a‘
   behind it *g*
    Without it, you generate again just crap 😉
 * Thanks s_ha_dum for your kindness and fast help!

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

The topic ‘Request URI’ is closed to new replies.

 * 4 replies
 * 2 participants
 * Last reply from: [caylean](https://wordpress.org/support/users/caylean/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/request-uri/#post-3080008)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
