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

  • SEARCH
  • Home
  • 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 6730535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:25:12+00:00 2026-05-26T10:25:12+00:00

This is my url: http://localhost/framework/index.php echo $_SERVER[‘REQUEST_URI’]; Would output: /framework/index.php But If my url

  • 0

This is my url:
http://localhost/framework/index.php

echo $_SERVER['REQUEST_URI'];

Would output: /framework/index.php

But If my url was:

http://localhost/framework/

The output would be:

/framework/

And If I move the file, yeah you get the idea.

How do I grab the content after folders/eventually index.php file? My idea is to have index.php as a front controller.

If I have:

http://localhost/framework/index.php/test/test

I only want the test/test part.

http://localhost/framework/test/test

I only want the test/test part.

  • 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-05-26T10:25:12+00:00Added an answer on May 26, 2026 at 10:25 am

    You can automatically detect the base uri and remove it, leaving you with the test/test part.

    if(!empty($_SERVER['PATH_INFO']))
    {
        // Uri info does not contain docroot or index
        $uri = $_SERVER['PATH_INFO'];
    }
    else
    {
        if(!empty($_SERVER['REQUEST_URI']) && !empty($_SERVER['HTTP_HOST']))
        {
           $fullUrl = 'http://'
                      . ((isset($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : '')
                      . ((isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '');
    
           $uri = parse_url($fullUrl, PHP_URL_PATH);
        }
        else if(!empty($_SERVER['PHP_SELF']))
        {
           $uri = $_SERVER['PHP_SELF'];
        }
    }
    
    $baseUri = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], "/")+1);
    $uri = str_replace($baseUri, '', $uri);
    

    Edit: mAu’s comment above is correct. I was under the assumption you was already using mod rewrite.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't get this: http://localhost/index.php/articles/edit/1/my-first-article This URL is mentioned as an example in the
i am having a url like http://localhost/joomla/Joomla_1.5.7/index.php?option=com_content&view=section&layout=blog&id=3&Itemid=55 and i want to redirect this to
By default my script is accessible by using this url http://localhost/myscript/public/ . But i
This is working: RewriteRule ^([a-z]{2}/){0,1}showCategory/([0-9]*)/([0-9]*)(/{0,1})$ /main.php?id=$2&il[lang]=$1&page=$3 [L] with this URL: http://localhost/showCategory/590/10 Now I want
What is the proper way to use URL parameters? My URL is this: http://localhost:8080/#pg5?testing=abc
When I run this code url = ('http://maps.google.com/maps/nav?'+ 'q=from%3A'+from_address+ '+to%3A'+to_address+ '&output=json&oe=utf8&key='+api_key) request = urllib2.Request(url)
i'm using extjs4 store In xhtpp calls it shows the http://localhost/home_dir/index.php/questions/content_pie?_dc=1312366604831&hi=&page=1&start=0&limit=25 This is the
I want this url http://www.youtube.com/watch?v=dgNgODPIO0w&feature=rec-HM-fresh+div to be transformed to: http://www.youtube.com/v/dgNgODPIO0w with php.
Say I have this url: http://site.example/dir/ In this folder I have these files: test.ascx.cs
H Regarding this URL http://www.codeproject.com/KB/aspnet/FlashUpload.aspx User.Identity as System.Web.Security.FormsIdentity is always null, because the Identity

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.