Many times you want to know the current page URL . Which is required many times like including images, stylesheet, including some jQuery plugin or using it for Facebook integration script etc.

Here i am going to tell you how to get the current page URL in PHP, WordPress, Joomla and Java Script.

PHP:-

$current_page_URL = $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];

Here $_SERVER["SERVER_NAME"]  will give you the doman name of your site and $_SERVER["REQUEST_URI"] will give you the rest

example:- for the URL http://http://www.7tech.co.in/php/get-url-of-current-page-php-wordpress/

$_SERVER["SERVER_NAME"]   will give you 7tech.co.in

$_SERVER["REQUEST_URI"] will give you /php/get-url-of-current-page-php-wordpress/

If you want to include Http or Https then add this condition

$current_page_URL =(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]==”on”) ? “https://” : “http://”;

$current_page_URL = $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];

 

WordPress:-

the_permalink()

This function returns you the link of the current page or post. If this function is used inside a WordPress loop than it will return the link of the current post inside the loop.

Alternatively you can use the $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"] also.

get_bloginfo(“siteurl) it will return you the blog url set in the wordpress->Settings->General

 

Joomla:-

You can use the Joomla API to find the current URL of the page.

JURI::current()

This will return current page URL.

JURI::base()  this will return you the base URL of your Joomla Site.

 

Java Script:-

window.location

It will return you current page url in Java Script.

81 Responses so far.

  1. Rooibos says:

    I found your blog on yahoo. I think it’s awesome.

  2. Thanks for the article. I thought it was good.

  3. Ugg Boots says:

    I don’t even know how I got here, but I thought this post was good. Cheers!

  4. No BS and well written, thank you for the post

  5. hyip says:

    Thankyou for sharing Get URL of current page in PHP, WordPress, Joomla & Java Script | Learn Php, WP, JS, Joomla & jQuery with us keep update bro love your article about Get URL of current page in PHP, WordPress, Joomla & Java Script | Learn Php, WP, JS, Joomla & jQuery .

  6. I like Your Article about Get URL of current page in PHP, WordPress, Joomla & Java Script | Learn Php, WP, JS, Joomla & jQuery Perfect just what I was looking for! .

  7. Thanks for sharing, I like this blog!

  8. i’m adding your blog’s rss feed so that I can see your new posts. Keep up the great work!

  9. I like this info presented and it has given me some sort of desire to have success for some reason, so thanks.

  10. Benton says:

    wish to appreciation for the work you get in writing this write-up. I really hope the same best work by you sometime soon as well. The truth is your creative writing ability has inspired me to begin my own blog site now.

  11. Hi, I want to ask you something. Is this a wordpress blog site? We are thinking of switching my web page from Blogger to wordpress, do you think this can be practical? Additionally did you create this unique theme by yourself some how? Thank you for the assistance!

  12. I’d must check with you here. Which is not something I often do! I enjoy reading a submit that can make folks think. Also, thanks for allowing me to comment!

  13. Pretty superior post. We just discovered ones web page in addition to wanted to help tell you of which We have quite enjoyed reading ones webpage in addition to reports. Anyways I’ll possibly be subscribing ones give in addition to When i wish to help study ones webpage once again.

  14. Fantastic piece of writing together with convenient that will understand story. How do That i set about gaining agreement that will put up part within the article in doing my coming bulletin? Offering good credit ranking to your any source together with weblink into the web page will not manifest as a challenge.

  15. Remarkable page as well as convenient in order to comprehend justification. Exactly how can We start gaining concur in order to put up part from the guide during my coming bulletin? Getting good credit score for you the actual journalist as well as backlink towards the websites won’t be considered a challenge.

  16. I loved as much as you’ll receive carried out right here. The sketch is attractive, your authored subject matter stylish. nonetheless, you command get got an shakiness over that you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly a lot often inside case you shield this hike.

  17. It’s laborious to find educated folks on this subject, but you sound like you know what you’re talking about! Thanks

  18. Very Interesting Blog! Thank You For Thi Blog!

  19. Really excellent information can be found on web blog .

  20. I am usually to running a blog and i actually appreciate your content. The article has actually peaks my interest. I am going to bookmark your website and preserve checking for brand spanking new information.

  21. Deon Lochte says:

    A formidable share, I just given this onto a colleague who was doing just a little evaluation on this. And he actually purchased me breakfast because I found it for him.. smile. So let me reword that: Thnx for the deal with! However yeah Thnkx for spending the time to debate this, I really feel strongly about it and love studying more on this topic. If attainable, as you develop into expertise, would you thoughts updating your blog with more details? It is highly helpful for me. Big thumb up for this weblog post!

  22. SVCreation says:

    some truly prize content on this internet site , bookmarked .

  23. I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy. I think it may be help all of you. Thanks.

  24. Hello! I could have sworn I’ve been to this website before but after checking through some of the post I realized it’s new to me. Anyhow, I’m definitely delighted I found it and I’ll be bookmarking and checking back frequently!

  25. renren876 says:

    Thank you for this kind of info I had been browsing all Msn to be able to find it!

  26. Robert says:

    Here we go again?- I’m spending an highly lengthy time reading these blogs. Oh Well! It was worth it.

  27. Thanks for sharing Get URL of current page in PHP, WordPress, Joomla & Java Script | Learn Php, WP, JS, Joomla & jQuery with us keep update bro love your article about Get URL of current page in PHP, WordPress, Joomla & Java Script | Learn Php, WP, JS, Joomla & jQuery .

  28. I’ve been surfing online more than 3 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all website owners and bloggers made good content as you did, the net will be much more useful than ever before.

  29. Hey siblings loves your beautiful editorial thanks and please carry forward

  30. Hi There! our family loves your amazing write-up thanks and please stick to it

  31. This article is usefull for me! thanks.

  32. Thank you for the good writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! However, how can we communicate?

  33. muzik dinle says:

    I am extremely impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you customize it yourself? Anyway keep up the excellent quality writing, it’s rare to see a nice blog like this one nowadays..

  34. I loved as much as you will receive carried out right here. The sketch is attractive, your authored subject matter stylish. nonetheless, you command get bought an impatience over that you wish be delivering the following. unwell unquestionably come more formerly again since exactly the same nearly very often inside case you shield this increase.

  35. I have been surfing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the net will be a lot more useful than ever before.

  36. Radyo says:

    I’m extremely impressed with your writing skills and also with the layout on your weblog. Is this a paid theme or did you customize it yourself? Anyway keep up the nice quality writing, it is rare to see a great blog like this one these days..

  37. health says:

    Hello there, You have done an incredible job. I will certainly digg it and personally suggest to my friends. I am sure they will be benefited from this site.

  38. Hiya very cool site!! Guy .. Excellent .. Superb .. I’ll bookmark your blog and take the feeds additionally…I am satisfied to seek out numerous helpful info here in the publish, we want develop more techniques in this regard, thank you for sharing.

  39. This is the right blog for anyone who wants to find out about this topic. You realize so much its almost hard to argue with you (not that I actually would want…HaHa). You definitely put a new spin on a topic thats been written about for years. Great stuff, just great!

  40. lee min ho says:

    I was suggested this blog by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my problem. You’re incredible! Thanks!

  41. UGGS says:

    I really liked the blog post. It is always nice when you can not only be informed, but also entertained!

  42. I was recommended this website by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my problem. You’re wonderful! Thanks!

  43. Wow, fantastic blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your site is magnificent, as well as the content!

  44. I loved as much as you will receive carried out right here. The sketch is tasteful, your authored subject matter stylish. nonetheless, you command get bought an impatience over that you wish be delivering the following. unwell unquestionably come further formerly again since exactly the same nearly very often inside case you shield this increase.

  45. porno izle says:

    Hi there, You’ve done a fantastic job. I will definitely digg it and personally suggest to my friends. I am confident they’ll be benefited from this website.

  46. Yoshop says:

    2011…

    Everything is very open and very clear explanation of issues. was truly information. Your website is very useful. Thanks for sharing….

  47. My friend mentioned to me your site, so I thought I’d come have a read. Very interesting insights, will be back for more!

  48. eskort says:

    Wonderful beat ! I would like to apprentice while you amend your web site, how could I subscribe for a blog website? The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear concept

  49. You aren’t the regular blogging site novelist, gentleman. You certainly have something successful for you to create the online. This very good weblog. We’ll returning for further.

  50. You actually make it seem so easy with your presentation but I find this matter to be really something that I think I would never understand. It seems too complicated and very broad for me. I’m looking forward for your next post, I will try to get the hang of it!

  51. çizgi film says:

    Hello There. I found your blog using msn. This is an extremely well written article. I will make sure to bookmark it and return to read more of your useful info. Thanks for the post. I’ll definitely return.

  52. garmin 1490t says:

    Dear admin, thnx for sharing this blog post. I observed it wonderful. Very best regards, Victoria…

  53. You really make it seem so easy with your presentation but I find this matter to be really something that I think I would never understand. It seems too complicated and extremely broad for me. I am looking forward for your next post, I will try to get the hang of it!

  54. It is the best time to make some plans for the future and it is time to be happy. I have read this post and if I could I want to suggest you some interesting things or suggestions. Maybe you can write next articles referring to this article. I want to read more things about it!

  55. Wonderful beat ! I wish to apprentice while you amend your web site, how could I subscribe for a blog site? The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear concept

  56. I’m still guidance from you, though I’m perplexing to grasp my goals. we positively suffer celebration of a mass all which is posted upon your site.Keep a report coming. we enjoyed it!

  57. sikiş porno says:

    Heya i’m for the first time here. I came across this board and I find It truly useful & it helped me out a lot. I hope to give something back and aid others like you helped me.

  58. I loved as much as you will receive carried out right here. The sketch is attractive, your authored subject matter stylish. nonetheless, you command get got an edginess over that you wish be delivering the following. unwell unquestionably come more formerly again since exactly the same nearly very often inside case you shield this hike.

  59. It’s some shame you don’t have a relatively give money press button! I’d definitely give money for this excellent webpage! I just think right now i’ll be satisfied bookmarking not to mention attaching a Feed towards your Search engine profile. I just take a look ahead towards unique messages and often will promote this unique weblog with the help of your Squidoo team:

  60. electronic says:

    Thanks much! Subscribed via rss.

  61. Yosezd says:

    2011…

    I appreciate, cause I found just what I was looking for. You’ve ended my four day long hunt! God Bless you man. Have a great day. Bye…

  62. paleo diet says:

    This blogis a great deal of much better than my cousin Steves blog. He really doesnt know what hes talking about.

  63. I like this post, enjoyed this one regards for posting. “No trumpets sound when the important decisions of our life are made. Destiny is made known silently.” by Agnes de Mille.

  64. Ycvddf says:

    2011…

    After all, what a great site and informative posts, I will upload inbound link – bookmark this web site? Regards, Reader….

  65. This is wonderful article ! I simply love’d it !

  66. BG mail says:

    I was very pleased to search out this web-site.I needed to thanks for your time for this excellent read!! I definitely enjoying each little little bit of it and I have you bookmarked to check out new stuff you blog post.

  67. It’s a shame you don’t have a give money press button! I’d definitely give money for this outstanding web page! I think at this point i’ll be satisfied with bookmarking and placing your Feed to my Google account. I look ahead to fresh messages and will promote this blog with my Facebook team:

  68. I’m really impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you customize it yourself? Anyway keep up the excellent quality writing, it’s rare to see a great blog like this one nowadays..

  69. dYcxcgcvf says:

    2011…

    Thank you for the sensible critique. Me and my neighbor were just preparing to do some research about this. We got a grab a book from our area library but I think I learned more from this post. I am very glad to see such wonderful info being shared fre…

  70. Neil Raniero says:

    Quite good article. I basically stumbled upon your webpage and desired to mention that I have definitely liked studying your blog and blogposts. Anyway I’ll be following your feed and I hope to read your blog again.

  71. the website is very good. i very like it. you are my my god… come here

  72. Don McGhee says:

    Howdy very cool blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also…I’m glad to search out numerous helpful info here in the publish, we want develop more strategies on this regard, thank you for sharing. . . . . .

  73. I really enjoyed the article. It’s always nice when you can not only be informed, but also entertained!

  74. WONDERFUL Post.thanks for share..more wait .. …

  75. Eric Swick says:

    Hey There. I found your weblog using msn. That is a very well written article. I will make sure to bookmark it and return to read extra of your useful information. Thanks for the post. I will certainly comeback.

  76. you have an interesting post on Get URL of current page in PHP, WordPress, Joomla & Java Script | Learn Php, WP, JS, Joomla & jQuery..I’ll bookmark http://www.7tech.co.in/php/get-url-of-current-page-php-wordpress and check back again for more new stuff..thanks from Iodine Supplement:)

  77. Have you ever considered adding more video clips into your blog posts to keep the readers greater entertained? I suggest I only read through the entire post as in yours and it was fairly good but since I’m greater of the visual learner,i discovered that for being more helpful well let me know the way it ends up! I love what you guys may be consistently up too. Such ingenious work and treatment! Keep up the good does its job guys I’ve additional you guys in order to my blogroll. it is a great article thanks for sharing this informative info.. i’ll go to your blog regularly for some latest post.

  78. Mike Terk says:

    excellent points altogether, you simply gained a new reader. What may you suggest in regards to your post that you simply made some days ago? Any positive?