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 6247815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:56:37+00:00 2026-05-24T12:56:37+00:00

I am trying to get something similar to $_SERVER[PATH_INFO] but weird server issues are

  • 0

I am trying to get something similar to $_SERVER[“PATH_INFO”] but weird server issues are preventing me from using it…

In my application, the links can look like

www.domain.com/folder/file/variable
www.domain.com/folder/file
www.domain.com/file/variable or
www.domain.com/file/

With .htaccess, I am trying to get to the proper pages, and not to redirect to the index.php or similar.

So far, I have this, which is not working 🙂

RewriteRule ^(.+)$ /$1.php # page only
RewriteRule ^(.+)/(.+)$ /$1.php?x=$2 # page + variable
RewriteRule ^(.+)/(.+)$ /$1/$2.php # folder / page 
RewriteRule ^(.+)/(.+)/(.+)$ /$1/$2.php?x=$3 # folder / page + variable

I am sure I need to use RewriteCond %{REQUEST_FILENAME} -f to check if the request is a filename, or directory… but I was unable to make it work…

Variables can contain all weird characters – that is why i am matching with dot… Maybe I should try to match file / folder names with a-z only ( since i do not think they will ever contain anything but a-z, _ or – ).

Any help is greatly appreciated, since its been almost two days of agony now 🙂

  • 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-24T12:56:37+00:00Added an answer on May 24, 2026 at 12:56 pm

    thanks to @LazyOne’s hint, I was able to solve this.

    htaccess file now looks something like this:

    RewriteRule ^([-a-zA-Z0-9_]+)/([-a-zA-Z0-9_]+)/([-a-zA-Z0-9_]+)$ /$1/$2.php?x=$3
    RewriteRule ^([-a-zA-Z0-9_]+)/([-a-zA-Z0-9_]+)/$ /$1/$2.php
    RewriteRule ^([-a-zA-Z0-9_]+)/([-a-zA-Z0-9_]+)$ /$1.php?x=$2
    RewriteRule ^([-a-zA-Z0-9_]+)/$ /$1.php
    

    all folder or files paths must end with “/” while variable must not. this is not a problem in my framework – but might not be useful for others.

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

Sidebar

Related Questions

I'm trying to get this simple PowerShell script working, but I think something is
I'm trying get values from a GridView using the following code: foreach (GridViewRow row
Trying to get an ASP application deployed; it worked for a while but then
I'm trying to get something very subtle to work, it looks pretty awful right
I'm trying to get: document.createElement('div') //=> true {tagName: 'foobar something'} //=> false In my
Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get
I am trying to do something similar to what the person in this question
I have a REST service that I'm trying to call. It requires something similar
I'm trying to achieve table similar to this using css/html only. Is it possible
I'm trying to implement something similar to this or this . I've created a

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.