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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:58:06+00:00 2026-05-29T06:58:06+00:00

I have this little .htaccess file: RewriteEngine on RewriteRule ^(.*)$ urlroute.php?q=$1 [E=myvariable:’withthisvalue’,B,QSA] To direct

  • 0

I have this little .htaccess file:

RewriteEngine on
RewriteRule ^(.*)$ urlroute.php?q=$1 [E=myvariable:'withthisvalue',B,QSA]

To direct all requests to my URL routing script. It works great and I can access the requested URL in urlroute.php as $_GET['q'].

I’m setting the environment variable myvariable using mod_rewrite
I am able to access it in urlroute.php as $_SERVER['myvariable']. I am not able to access it using $_ENV['myvariable'] which seems strange. Could someone please explain what the reason could be?

To my knowledge, mod_redirect will prepend REDIRECT_ to environment variable names when doing a redirect (which it always does in my case). But for me both $_SERVER['myvariable'] and $_SERVER['REDIRECT_myvariable'] are available and set to the same content. Why?

  • 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-29T06:58:06+00:00Added an answer on May 29, 2026 at 6:58 am

    See this post also discusses the same feature. The rewrite engine loops on evaluating .htaccess files at the start of each cycle the engine copies any environment variables into a copy REDIRECT_*. Hence if the parsing of the .htaccess files requires 3 loops then you will also get REDIRECT_REDIRECT_* files, and so on.

    Apache 2.3 includes a new [E] flag but you can used this feature to implement the same in earlier versions:

    RewriteCond %{ENV:REDIRECT_END} =1
    RewriteRule ^   -  [L]   
    
    # other rules
    
    ...
    
    RewriteRule somepattern  somesubst   [L,E=END:1]
    

    AFAIK, these variables will available the SERVER context, but whether they are available in the ENVIRONMENT depends on how PHP is implemented e.g. Apache+mod_php, Apache+mod_suphp, Apache+mod_fcgi, IIS, …

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

Sidebar

Related Questions

Good morning. I currently have this little rule in my .htaccess RewriteEngine On RewriteBase
I have this little function function makewindows(){ child1 = window.open (about:blank); child1.document.write(<?php echo htmlspecialchars(json_encode($row2['ARTICLE_DESC']),
I've recently added this little bit of code to my .htaccess file: RewriteCond %{REQUEST_FILENAME}
Hey there, I have this little php code: <p class=category_text><? echo $category_text; ?></p> I
I have this little code which lists all matches of items that contains the
I have this little script to toggle a contact form when a button is
I have this little rake task: namespace :db do namespace :test do task :reset
I have this little problem, that I cannot figure out which arguments to pass
I have this little question that's been on my mind for a while now.
I have this little problem. My client wanted two distinct swf on a web

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.