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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:41:31+00:00 2026-06-17T06:41:31+00:00

I have a small website. It’s .htaccess file is like this: RewriteEngine On RewriteBase

  • 0

I have a small website. It’s .htaccess file is like this:

RewriteEngine On
RewriteBase /site/
RewriteRule ^(.+)$ index.php [QSA,L]

So it redirects all the URLs to ‘index.php’. I can get the requested URL and act accordingly :

$uri = $_SERVER['REQUEST_URI'];
switch($uri)
{
case 'index':
    LoadIndex();
    break;

case 'about':
    LoadAbout();
    break;

case 'Posts':
    LoadPosts();
    break;

default:
    LoadNotFound();
}

Say I want to use $_GET[] in Index page. That changes the URL, so it fails to load the page.
How can I do that? How can I route my site without affecting $_GET[] variables in URLs?

  • 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-17T06:41:32+00:00Added an answer on June 17, 2026 at 6:41 am

    $_SERVER[REQUEST_URI] will be /index.php and not index. $_SERVER[REQUEST_URI] also includes the QUERY_STRING. So, it might be /index.php?var1=abc&var2=def.

    If you need only the URI path, try PHP_SELF or SCRIPT_NAME. But keep in mind, that these will be /index.php too, including / and .php.

    $uri = $_SERVER['PHP_SELF'];
    switch($uri)
    {
    case '/index.php':
        LoadIndex();
        break;
    ...
    }
    

    You don’t need QSA in your RewriteRule. From RewriteRule Directive

    Modifying the Query String
    By default, the query string is passed through unchanged.

    This means, the $_GET variable is available in your PHP script as before.

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

Sidebar

Related Questions

I have a small website where I have wrote some rules RewriteEngine On RewriteRule
I have a small website for a company that have 40-50 product. The site
I have a small website sitting in a sub-domain of my main site. I'm
we have a small flash component on our website/application to upload multiple files. This
On a website I have a number of small PHP scripts to automate changes
I have published a small website and I'm using an excel file as a
Possible Duplicate: Simple PHP Mailer Script i run a small website and we have
I have a small PHP website with most of my pages of the form:
I have a small Orchard website that I'm hosting on Windows Azure. This website
I have small problem. I've coded a full website in php using CodeIgniter framework.

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.