Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to get the full http address and querystring from WordPress?

Posted on 2013-01-24
3
Medium Priority
?
483 Views
Last Modified: 2013-01-24
I am trying to get the full http address including any querystrings, from a wordpress page (I am building a WP theme).

None of the $_REQUEST attempts I try work.

Here is the page I am working on: http://www.the1stdistrict.com/blog/final-election-results

Is there a way for me to query WP to get the full address listed above?
0
Comment
Question by:rascal
  • 2
3 Comments
 
LVL 15

Expert Comment

by:Ess Kay
ID: 38815668
<?php
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $url;
?>



http://www.phpeasystep.com/phptu/27.html
0
 
LVL 15

Accepted Solution

by:
Ess Kay earned 2000 total points
ID: 38815682
When you run $_SERVER['HTTP_HOST']; you'll get result "www.apple.com" only, no "http://" no "/downloads/dashboard/email_messaging/todo.html"



When you run the script "$_SERVER['REQUEST_URI']" you'll get the result below.
no "http://" and no "www.apple.com

blog/final-election-results



hope that helps
0
 
LVL 1

Author Closing Comment

by:rascal
ID: 38815715
Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question