We help IT Professionals succeed at work.
Get Started

mod_rewrite on windows200 cant access URL variables

waygood asked
Last Modified: 2010-03-04
Hi people

I have a mod-rewrite which works on my linux server, BUT I want to develop on my local windows 2000 machine. I am using

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]*)$ /$1.php [L,NC]
RewriteRule ^([^/]*)/([^/]*)$ /$1.php?level_1=$2 [L,NC]

I have a phpinfo.php file which does a phpinfo(); to show all the settings.
The rewrite works ok.  ie http://localhost/phpinfo/1    rewrites as phpinfo.php?level1=1 (there is no subdirectory /1)

The big problem is that although linux shows $_GET variables, windows doesnt.

I get the following:-

WINDOWS 2000, Apache 1.3.28
_SERVER["REQUEST_URI"] /phpinfo/1
_SERVER["PATH_TRANSLATED"] c:\\wwwroot\\1
_SERVER["PHP_SELF"] /phpinfo/1
_SERVER["argv"] Array
_SERVER["argc"] 0

LINUX, Apache 1.3.29
_SERVER["REQUEST_URI"] /phpinfo/1
_SERVER["SCRIPT_NAME"] /phpinfo.php
_SERVER["PATH_INFO"] /phpinfo.php
_SERVER["PATH_TRANSLATED"] /homepages/15/d38847442/htdocs/phpinfo.php
_SERVER["PHP_SELF"] /phpinfo.php
_SERVER["argv"] Array
    [0] => level_1=1
_SERVER["argc"] 1
Watch Question
This problem has been solved!
Unlock 1 Answer and 20 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE