Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8859699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:07:38+00:00 2026-06-14T15:07:38+00:00

I am struck in getting the URI in my wordpress application and lack of

  • 0

I am struck in getting the URI in my wordpress application and lack of PHP knowledge is making my progress slow.
I have this URL

http://abc.com/my-blog/abc/cde 

i need to create a URL something like

http://abc.com/my-blog/added-value/abc/cde

where http://abc.com/my-blog is the URL of my wordpress blog which i can easily get using following method

home_url()

i can use PHP $_SERVER["REQUEST_URI"] to get request URI which will come up as

/my-blog/abc/cde

and than i have no direct way to add value as per my requirement

is there any way to achieve this easily in PHP or WordPress where i can get following information

  1. Home URL
  2. Rest part of the URL

so that in end i can do following

Home-URL+ custom-value+Rest part of the URL

My point of Confusion

  1. On my local set up $_SERVER["REQUEST_URI"] is giving me /my-blog/abc/cde, where /my-blog is installation directory of wordpress and i can easily skip first level.
  2. On production server its not same as /my-blog will not be part of the URL.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:07:39+00:00Added an answer on June 14, 2026 at 3:07 pm

    Very briefly:

    <?php
    
    $url = "http://abc.com/my-blog/abc/cde";
    
    $parts = parse_url($url);
    
    $path = explode("/", $parts["path"]);
    array_splice($path, 2, 0, array("added-part")); //This line does the magic!
    
    echo $parts["scheme"] . "://" . $parts["host"] . implode("/",$path);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm stuck in getting the product url in a product collection. I have this
hi am really struck with this question. I'm new in android world.I have a
Could someone help me understand why I'm getting this error: javax.xml.bind.UnmarshalException: unexpected element (uri:,
I have a function (bobB) that seems to be getting stuck in a while
I have an INSERT query in Oracle 10g that is getting stuck on a
I have a simple PHP script with a form that has two select fields,
I'm getting stuck on how to count a date. I have 3 different columns:
I fear this is a very trivial question. But I'm having some trouble getting
i struck up with the FWD geocoder issue service not foundin getting the lat
am really struck here. Actually the problem is, i have 2 web pages name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.