Rewrite_mod RewriteRule problem


#1

I’m new when it comes to using rewrite_mod on apache, and I seem to be having a problem that should be easy to figure out, but I have no idea what’s going on.

I’m in a directory mysite.com/ and I want to rewrite all requests for a sub-directory to a php script. So mysite.com/subdir gets rewritten to mysite.com/script.php?var=subdir

What I came up with is this (assume RewriteEngine on):

rewriteRule ^(.*) /script.php?var=$1 [L]

But that returns a 500 internal error. What’s weird is if I try

rewriteRule ^test/(.*) /script.php?var=$1 [L]

and give the server a request for mysite.com/test/subdir it works. Why does it work for one and not the other? Thanks.


#2

[quote]rewriteRule ^(.*) /script.php?var=$1 [L]

But that returns a 500 internal error. [/quote]
Iteration - From Wikipedia, the free encyclopedia

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#3

RewritCond $1 !^script.php$
RewriteRule (.*) /script.php?var=$1 [L]